Changes

From Genome Analysis Wiki
Jump to navigationJump to search
1,186 bytes added ,  18:50, 8 September 2015
→‎Bring in changes from a subtree's remote: It won't work if you only have the remote but not the branch.
Line 243: Line 243:  
git checkout branch_you_want
 
git checkout branch_you_want
 
git commit
 
git commit
 +
 +
 +
== Subtrees ==
 +
=== Bring in changes from a subtree's remote ===
 +
If the remote is not already a part of this git repo:
 +
#Add other project as a branch and fetch (-f).
 +
#:<pre>git remote add -f libStatGen_remote https://github.com/statgen/libStatGen.git</pre>
 +
#Create & checkout a branch for the remote.
 +
#* taking <code>master</code>:
 +
#: <pre>git checkout -b libStatGen_branch libStatGen_remote/master</pre>
 +
#* taking a tag:
 +
#: <pre>git checkout -b vt_branch_SWS tags/SWS</pre>
 +
 +
If the branch is already a part of this git repo:
 +
#Checkout the branch
 +
#: <pre>git checkout libStatGen_branch</pre>
 +
#Bring in the new version
 +
#: <pre>git pull</pre>
 +
 +
=== Merge the changes from the subtree into the base repository ===
 +
#Go back to the master branch
 +
#: <pre>git checkout master</pre>
 +
#(Optional) Only if adding a new subdirectory, do:
 +
#: <pre>git read-tree --prefix=src/libStatGen -u libStatGen_branch</pre>
 +
#Merge in the new version.
 +
#: <pre>git merge --squash -s subtree --no-commit libStatGen_branch</pre>
 +
#:* --squash: do not merge histories
 +
#:* -s subtree: merge strategy
 +
#:*--no-commit: just merge, don’t commit the changes
 +
#Commit the changes
 +
#: <pre>git commit -m “message”</pre>
61

edits

Navigation menu