You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Git is a free and open source distributed version control system. It allows to track changes in source and allows multiple people to work on the same code base.

The repositories are hosted on GitHub.

The analysis code for lcls currently lives in

Setup git

The following steps describe how to setup git. This setup has to done only once for the machine where you are planing to develop code.

  • Setting the user name in git:
    git config --global user.name "my name"

  • Setting the email address in git:
    git config --global user.email "my email"
Confirm that your user name is correct by:
git config --global user.name

Confirm that your email is correct by:
git config --global user.email
GitHub account
Setup ssh keys for your github account * https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/

git clone git@github.com:lcls-psana/xtcav.git

 

Useful Commands

Check status of the repo

git status

Show branches of the repo

git branch -a

Adding new files to the git repo

git add "file"

Create new branch

git checkout -b "new branch"

Commit changes

There are two different ways to commit changes in git: The first way is to automatically stage all files that git is tracking bash git commit -a -m "commit message" The other option is to specifically stage the files you want to commit bash git add "files that you changed" git commit -m "commit message"

If upstream is ahead of your local version bash git fetch origin git rebase -p origin

if

git rebase --skip ignores local change

change file locally and commit changes

git rebase --continue
git push origin master

More information https://www.derekgourlay.com/blog/git-when-to-merge-vs-when-to-rebase/

Push commits upstream

git push origin "branch name"

 

  • No labels