Difference between revisions of "Git"

From Useful Things
Jump to: navigation, search
Line 24: Line 24:
 
git remote set-branches origin <branch-name>
 
git remote set-branches origin <branch-name>
 
</pre>
 
</pre>
 +
 +
== Show contents of merge commit ==
 +
<pre>
 +
git show -m [SHA1]
 +
</pre>
 +
where <code>-m</code> means maximum verbosity, automatically implied only with non-merge commits

Revision as of 23:10, 29 January 2015

Undo last commit and KEEP changes

git reset --soft HEAD~1

Undo last commit and LOSE changes

git reset --hard HEAD~1

List all remote branches

git ls-remote --heads <remote-name>

where remote-name is usually something like origin

Checkout remote branch and set it up for tracking

Note: These instructions are specific to having cloned in this manner: git clone -b <branch-name> --single-branch as it only tracks the branch chosen at clone time.

git fetch origin <branch-name>
git remote set-branches origin <branch-name>

Show contents of merge commit

git show -m [SHA1]

where -m means maximum verbosity, automatically implied only with non-merge commits