diff --git a/src/git/first-side/column1.md b/src/git/first-side/column1.md index a22d82f..ad86973 100644 --- a/src/git/first-side/column1.md +++ b/src/git/first-side/column1.md @@ -16,7 +16,7 @@ Add <file> contents to the index `git add ` Remove <file> from the index -`git reset ` +`git restore --staged ` Add current contents of the index in a new commit `git commit -m 'subject' -m 'body'` diff --git a/src/git/reverse/column1.md b/src/git/reverse/column1.md index e9ad729..1fa7d0e 100644 --- a/src/git/reverse/column1.md +++ b/src/git/reverse/column1.md @@ -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` @@ -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 ` +`git restore --staged --worktree ` Revert a commit (add a new commit with contrary changes) `git revert `