Editing A commit message

shivam@sj:~/git-tut$ git init
Initialized empty Git repository in /home/shivam/git-tut/.git/
shivam@sj:~/git-tut$ touch temp.txt
shivam@sj:~/git-tut$ git add .
shivam@sj:~/git-tut$ git commit -m "initial commit"
[master (root-commit) f9d591e] initial commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 temp.txt
shivam@sj:~/git-tut$ git log --oneline
f9d591e (HEAD -> master) initial commit
shivam@sj:~/git-tut$ git log --oneline
b98c458 (HEAD -> master) commit num 5
0bd1c82 commit nim 4
327c7e6 commit nom 33
8503722 commit num 2
d826ef2 commit num 1
f9d591e initial commit
shivam@sj:~/git-tut$
shivam@sj:~/git-tut$ git log --oneline
b98c458 (HEAD -> master) commit num 5
0bd1c82 commit nim 4327c7e6 commit nom 338503722 commit num 2d826ef2 commit num 1f9d591e initial commit
shivam@sj:~/git-tut$
shivam@sj:~/git-tut$ git rebase -i 8503722
pick 327c7e6 commit nom 33
pick 0bd1c82 commit nim 4
pick b98c458 commit num 5
r 327c7e6 commit nom 33
r 0bd1c82 commit nim 4
pick b98c458 commit num 5
commit nom 33
commit num 3
shivam@sj:~/git-tut$ git rebase -i 8503722
[detached HEAD bf50ada] commit num 3
Date: Tue Sep 21 02:08:43 2021 +0530
1 file changed, 47 insertions(+), 1 deletion(-)
[detached HEAD a6a9712] commit num 4
1 file changed, 26 insertions(+)
Successfully rebased and updated refs/heads/master.
shivam@sj:~/git-tut$
shivam@sj:~/git-tut$ git log --oneline
99fccce (HEAD -> master) commit num 5
a6a9712 commit num 4
bf50ada commit num 3
8503722 commit num 2
d826ef2 commit num 1
f9d591e initial commit
shivam@sj:~/git-tut$
git push -f origin master

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Shivam Pandey

Shivam Pandey

8 Followers

A nomad coder who keeps looking at diiferent languages in search of fun.