48
loading...
This website collects cookies to deliver better user experience
git commit --amend
[main 1a7b82d] Adding jsons
Date: Sat Jun 19 11:16:19 2021 +0530
3 files changed, 242 insertions(+)
create mode 100644 package-lock.json
create mode 100644 package.json
create mode 100644 resume.json
git commit --amend -m "Adding jsons"
git add .gitignore
git commit --amend
--amend --no-edit
. It will not open an editor as it does not expect the commit message to change. It will instantly apply changes and output the last commit.git commit --amend --no-edit
[main 65f3784] Adding jsons
Date: Sat Jun 19 11:16:19 2021 +0530
5 files changed, 246 insertions(+)
create mode 100644 .gitignore
create mode 100644 package-lock.json
create mode 100644 package.json
create mode 100644 resume.json
create mode 100644 test.txt
git checkout -- test.txt
git checkout branch-name
).revert
and reset
commands but I will cover them separately. I don't consider those to be basic scenarios.git branch new-correct-branch
git reset --hard HEAD~
--hard
. If there are more changes after the wrong commit, make sure you stash them first.git checkout new-correct-branch
git log
or a UI like Github Desktop or browser. Find the commit id. For e.g. git log
returns us the below commits:
A -> B -> C -> D -> E
git revert 1df455v631fca -m "Reverting commit"
A -> B -> C -> D -> E -> -C