Skip to content

Instantly share code, notes, and snippets.

@tonycn
Last active August 29, 2015 14:19
Show Gist options
  • Save tonycn/6a42d35f5ca0d90be85e to your computer and use it in GitHub Desktop.
Save tonycn/6a42d35f5ca0d90be85e to your computer and use it in GitHub Desktop.
Git commands
git clone git://xxx
git remote add upstream git://xxx
# create branch to develop
git checkout -b dev
git add file1
git commit ...
# fetch and rebase to upstream/master
git fetch upstream
git rebase -i upstream/master
git push origin HEAD
# Pull request
# branch related commands
git branch -a
git checkout branchA
git checkout -b newBranch
# how to rollback
git reset --soft HEAD^1
git reset --hard upstream/master
# git remote repo
git remote -v
git remote add origin git://xxx
#force push remote repo
git push -f origin HEAD
# misc
git help {command}
git clean -df
git stash / git stash pop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment