Kate learns Git: a choose your own adventure
Goal: become comfortable with the ATLAS Git workflow so that I can be useful again.
I need to understand how to easily update my code to pick up new changes centrally, control the branches i am on and syncing with, do everything while maintaining a sparse checkout, and request my changes be merged.
Relevant links
Documentation
The ATLAS tutorial is
here
and the jet trigger specific tutorial is here.
Somebody else's useful Git twiki is
here.
Kerim's running instructions from June P&P week are
here
.
Code
Athena home
My athena fork
A full walkthrough of
What's going on?
Find the branch I'm on
Find the branches available
For all local and remote branches,
git branch -a
For just all remote branches,
git branch -r
Make a new branch
git branch -b myNewBranch
Find out the branches i'm pointing to
git branch -vv
example:
-bash-4.1$ git branch -vv
* 21.0-add-TrigHLTJet-caloWIDTH 7565218 [origin/21.0-add-TrigHLTJet-caloWIDTH: ahead 1] first try help
master a7f6dc3 [origin/master] Merge branch 'cherry-pick-f12f2321' into 'master'
First line: branch I am on and the latest commit
Second line:
Update everything I have locally to the most recent version in the central Athena repository
To download the updates which exist in Athena centrally, assuming upstream is properly set (see above):
git fetch upstream
Now checkout would potentially mess with the sparse checkout I have, so do:
git pull upstream 21.0
We aren't tracking a particular branch so specifying the branch of upstream to use is mandatory.
Pushing a new branch
If your branch is listed, as in:
-bash-4.1$ git branch -a
* 21.2-add-PathResolver
master
git push will still not create this branch unless you explicitly tell it to. Use
git push origin 21.2-add-PathResolver
to create it in the remote repository.
Resolving merge conflicts
To see which files have conflicts:
git status
Once I know a problem has been resolved and the version I have locally is the one I want to keep
git add <file>
I have local changes I want to keep, and the ...
Making a merge request
Easiest thing is to do this manually using "Create merge request" button when looking at the gitlab web interface for the relevant branch!
- Check that correct source and destination branches are selected
- Write detailed description
- Inspect changes before hitting "submit merge request"
- "Labels" drop-down on the RHS allows you to choose other releases for this to be cherry-picked into