Use case | Command (with example) |
---|---|
Start a new repo | git init |
Clone existing repo | git clone https://:@git.cern.ch/kerberos/cms-hlt![]() |
Add files to be tracked | git add somefile.cc |
See status of the repo | git status |
git status -s | |
Commit added changes | git commit -m "Some message" |
See remote repositories | git remote -v |
Push changes to default remote repository | git push |
Push changes to remote repository by alias | git push remote-repo-alias |
Fetch changes from default remote repository | git fetch |
Fetch changes from remote repository by alias | git fetch remote-repo-alias |
Merge changes from remote repository by alias | git merge remote-repo-alias/remote-repo-branch |
Fetch and merge all remote changes from default remote | git pull |
Create new branch locally | git checkout -b branch-name |
Push new branch to remote | git push remote-alias branch-name |
Delete local branch | git branch -d branch-name |
Delete remote branch | git push origin --delete branch-name |