
5

Directly update git commit
source link: http://www.donghao.org/2020/12/10/directly-update-git-commit/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Directly update git commit
Previously when I want to update my branch of git, I just commit new modifications again and again. This makes my branch log quite ugly.
After my colleague introduced git --amend
to me, he really helps me a lot. Now, I just use
git commit -a --amend --no-edit
Python
git commit -a --amend --no-edit
to update my modification into previous commit and
git push -f origin my_branch_name
Python
xxxxxxxxxx
git push -f origin my_branch_name
to totally update my branch in remote
And, if I want to also change the message of my previous comment, I only need to
git commit -a --amend -m "Let's rock again"
Python
xxxxxxxxxx
git commit -a --amend -m "Let's rock again"
Like this:
Loading...
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK