SourceControl‎ > ‎

Git

Subpage Listing



Documentation

Show branch/info
$git branch -v -a
$git branch -a
$git branch -r
$git remote show origin

List revision
$git rev-list -n 2 HEAD -- <file_path>

Retrieve new branch
$git fetch origin
$git fetch origin --prune

Create Branch
$git checkout -b test origin/test

Set upstream
$git branch --set-upstream-to=origin/<BRANCH> <BRANCH>

Push to Origin
$git push -u origin <BRANCH>

Merge
$git merge --no-ff <BRANCH>

Reset
$git fetch origin 
$git reset --hard origin/master

Remove
delete local branch
$git branch -d testing
$git branch -D testing (force)

Delete branch
$git push origin :<BRANCH> or :refs/heads/<BRANCH>

Undelete
if a file was removed but not commit
$git reset <file>
else
$git checkout <file> ??

Get revision
$git checkout <revision>^ -- <file_path>

Rebase (update to one commit)
$git update-ref -m "reset: Reset <branch> to <new commit>" refs/heads/<branch> <commit>

Merge/cherry pick
$git cherry-pick b50788b
(note: don't forget to do a pull locally from the origin branch)



Subpages (4): git ignore misc stash tags
Comments