Changes

Jump to navigation Jump to search
919 bytes added ,  19:12, 28 April 2013
→‎Resetting the repository: http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg30825.html
Line 309: Line 309:  
  git branch -t -l release/2.6.0 origin/release/2.6.0
 
  git branch -t -l release/2.6.0 origin/release/2.6.0
 
  git checkout -b release/2.6.0
 
  git checkout -b release/2.6.0
 +
 +
=== Messed up branches ===
 +
Backing it out might be a bit tricky, but you can rename your messed up branch out of the way easily with git branch -m oldname newname.
 +
 +
To cherry-pick commits from your other repository into a branch you first fetch the branch you want to pick, e.g.
 +
 +
'''git fetch theOtherRepro.git theotherbranch:suitableName/theotherbranch'''
 +
 +
Or just '''theotherbranch:suitableOthername'''
 +
 +
Then you can inspect the commits on it with '''git log -u theOtherRepro/theotherbranch'''
 +
 +
And finally cherry-pick the one you want with '''git cherry pick <commitID>'''
 +
 +
 +
It's a good idea to always use a clean local copy (e.g. git branch -t mrClean origin/master)  of origin/master to cherry-pick commits to before pushing to origin, and leave that branch around since the next time you just need to check it out, do '''git pull''' which will be a clean fast forward and '''cherry-pick''' and push again.
    
=== Resetting the repository ===
 
=== Resetting the repository ===
Line 330: Line 346:  
git diff
 
git diff
 
</pre>
 
</pre>
to investigate what ever uncommitted changes you may have in your tree.
+
to investigate what ever uncommitted changes you may have in your tree. If you want to throw all such changes away, use '''git reset --hard'''
If you want to throw all such changes away, use '''git reset --hard'''
      
Or you can use '''git stash''' to save them for later.
 
Or you can use '''git stash''' to save them for later.
   −
If you have an old branch with your work and want to reapply selected commits to the new one, git cherry-pick is a useful command.
+
If you have an old branch with your work and want to reapply selected commits to the new one, '''git cherry-pick''' is a useful command.
    
=== Git tutorials and resources ===
 
=== Git tutorials and resources ===

Navigation menu