Add git-checkout example for files across branches
This commit is contained in:

committed by
Agniva De Sarker

parent
8d3a48c689
commit
e04863b55d
@@ -2,14 +2,18 @@
|
|||||||
|
|
||||||
> Checkout a branch or paths to the working tree.
|
> Checkout a branch or paths to the working tree.
|
||||||
|
|
||||||
- Switch to another branch:
|
|
||||||
|
|
||||||
`git checkout {{branch_name}}`
|
|
||||||
|
|
||||||
- Create and switch to a new branch:
|
- Create and switch to a new branch:
|
||||||
|
|
||||||
`git checkout -b {{branch_name}}`
|
`git checkout -b {{branch_name}}`
|
||||||
|
|
||||||
|
- Switch to an existing branch:
|
||||||
|
|
||||||
|
`git checkout {{branch_name}}`
|
||||||
|
|
||||||
- Undo unstaged local modification:
|
- Undo unstaged local modification:
|
||||||
|
|
||||||
`git checkout .`
|
`git checkout .`
|
||||||
|
|
||||||
|
- Replace a file in the current working directory with the version of it committed in a given branch:
|
||||||
|
|
||||||
|
`git checkout {{branch_name}} -- {{file_name}}`
|
||||||
|
Reference in New Issue
Block a user