Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/git/first-side/column1.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Add <file> contents to the index
`git add <file>`

Remove &lt;file&gt; from the index
`git reset <file>`
`git restore --staged <file>`

Add current contents of the index in a new commit
`git commit -m 'subject' -m 'body'`
Expand Down
5 changes: 3 additions & 2 deletions src/git/reverse/column1.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Branch

Create a new local branch and switch HEAD branch
`git checkout -b newBranch`
`git switch -c newBranch`

List local branches
`git branch`
Expand All @@ -23,9 +23,10 @@ List all operations on repository

Discard all local changes in your working directory
`git reset --hard HEAD`
**Be careful: you may lose valuable work!**

Discard local changes in a file
`git checkout HEAD <file>`
`git restore --staged --worktree <file>`

Revert a commit (add a new commit with contrary changes)
`git revert <commit>`
Expand Down