Changes

From Genome Analysis Wiki
Jump to navigationJump to search
228 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 246: Line 246:     
== Subtrees ==  
 
== Subtrees ==  
=== Remote is not a part of this git repo: Add the branch ===
+
=== Bring in changes from a subtree's remote ===
Add it:
+
If the remote is not already a part of this git repo:
#Add other project as a branch and fetch (-f)
+
#Add other project as a branch and fetch (-f).
#:git remote add -f libStatGen_remote https://github.com/statgen/libStatGen.git
+
#:<pre>git remote add -f libStatGen_remote https://github.com/statgen/libStatGen.git</pre>
#Create & checkout a branch for the remote
+
#Create & checkout a branch for the remote.
#:git checkout -b libStatGen_branch libStatGen_remote/master
+
#* 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>
   −
=== Remote is part of this git repo: Bring in the latest version ===
+
If the branch is already a part of this git repo:
 
#Checkout the branch
 
#Checkout the branch
#:git checkout libStatGen_branch
+
#: <pre>git checkout libStatGen_branch</pre>
 
#Bring in the new version
 
#Bring in the new version
#:git pull
+
#: <pre>git pull</pre>
    
=== Merge the changes from the subtree into the base repository ===
 
=== Merge the changes from the subtree into the base repository ===
 
#Go back to the master branch
 
#Go back to the master branch
#:git checkout master
+
#: <pre>git checkout master</pre>
 
#(Optional) Only if adding a new subdirectory, do:
 
#(Optional) Only if adding a new subdirectory, do:
#:git read-tree --prefix=src/libStatGen -u libStatGen_branch
+
#: <pre>git read-tree --prefix=src/libStatGen -u libStatGen_branch</pre>
#Merge in the new version. --squash: do not merge histories; -s: merge strategy; --no-commit: just merge, don’t commit the changes
+
#Merge in the new version.
#:git merge --squash -s subtree --no-commit libStatGen_branch
+
#: <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
 
#Commit the changes
#:git commit -m “message”
+
#: <pre>git commit -m “message”</pre>
61

edits

Navigation menu