Requirements
To follow this setup, it is required to have following …
•
No Requirements
Checkout [git checkout]
Updates files in the working tree to match the version in the index or the specified tree. If no pathspec was given, git checkout will also update HEAD to set the specified branch as the current branch.
Synopsis [git checkout --<synopsis>]
git checkout [-q] [-f] [-m] [<branch>]
git checkout [-q] [-f] [-m] --detach [<branch>]
git checkout [-q] [-f] [-m] [--detach] <commit>
git checkout [-q] [-f] [-m] [[-b|-B|--orphan] <new-branch>] [<start-point>]
git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <pathspec>…
git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] --pathspec-from-file=<file> [--pathspec-file-nul]
git checkout (-p|--patch) [<tree-ish>] [--] [<pathspec>…]
YAML
복사
Commonly Used Commands
•
Default checkout
◦
git checkout <hash address>
◦
git checkout <HEAD^ or HEAD~#>
▪
ex. git checkout HEAD^^^^^
▪
ex. git checkout HEAD~5
•
Undo
◦
git checkout -
•
Remote
◦
Checkout remote commit before pulling
1.
git fetch
2.
git checkout <remote name>/<branch name>
3.
Check code
4.
git checkout <branch name>
5.
(Optional) git pull to use the code
◦
Checkout remote commit and pull it to the new branch
1.
git fetch
2.
git branch -a to see the remote branches
3.
git checkout <remote name>/<branch name>
4.
git checkout main
5.
git switch -t <remote name>/<branch name>
