Detailed git Commands

Cloning

git clone

To clone a new repo in order to work on it locally, copy the link to the repo on the corresponding BitBucket page.

Open a terminal in the folder you want to clone the repo into and type in git clone link

This will create a local copy of the current state of the repo for you to work on.

(To Add: Something about branching practices)

Pulling

git pull

In order to copy the most recent changes from the official repo to your local copy, open a terminal in the repo's corresponding folder and type in git pull

If this throws an error, you may have uncommitted changes that need to be addressed in order to merge the two repos. (This can be avoided by branching).

Adding

git add

To stage all changes or created files to be committed, you can use the command git add -A

Committing

git commit

You can commit multiple times if you want to keep track of certain projects or files being changed in each commit.

The modifier -a will grab all changed files and add them to the commit.

Note: this will not add new files to the commit.

The modifier -m followed by parenthesis surrounding a message “commit message” will include the message to the commit.

Ex: git commit -a -m “formatting changes to Beamline display”

Pushing

git push

This command pushes all staged commits to the official repo to be merged.

Merging

To get your changes merged to the repo, create a pull request on the Bitbucket website.

Ensure you are merging from the desired repo to the correct repo. In the below example, main to release/fc5

After hitting continue, you will be met by the following screen, allowing you to change the title or body of your commit message. If there is not a Reviewer already populated, make sure you add one appropriate to the repo you are attempting to push to.