Terminology
git checkout . ¶ Undo all unstaged changes in the current folder.
git checkout — <filepath> ¶ Roll back changes to a modified file.
git checkout -b <branch> <remote>/<remotebranch> ¶ Create local branch <branch> as tracking branch of <remote> branch <remotebranch>.
git checkout -b <name> ¶ Create a new local branch and make it the current branch.
git checkout <branch>; git checkout <branch>~<n> <file> ¶ Revert a file <n> revisions.
git checkout <commit> ¶ Rather than checking out a branch to work on it, check out a commit for inspection and discardable experiments.
git checkout —track <remote>/<remotebranch> ¶ Create local branch <remotebranch> as tracking branch of <remote> branch <remotebranch>.
Facts, Thoughts and Opinions
Git Commit and Merge Master
git checkout master
git pull
git checkout -
git merge master
git newbranch
Creates a branch, checks it out, and pushes it to the git server in one command.
!f(){ git branch $1 && git checkout $1 && git push -u origin $1; };f
Images
- Subtopics
- Writings
Sources & Bookmarks
Name/Link | ¶ | Date |
---|---|---|
git checkout (DDG) | ¶ | 2014-06 |
git checkout (kernel.org) | ¶ | 2014-06 |
How to Undo in Git | ¶ | 2015-05 |