Dieses Blog durchsuchen

Samstag, 15. Oktober 2016

git: add / delete / modify a file on your last commit with --amend. Manipulate your history

Sometimes you forget an important change on your last commit and you have to commit a further change to your repo. This will look ugly in your commit history.

Here is a trick to let the forgotten change look like it was added in your last commit. This prevents discussions in your team about the last commits.


git add <forgotten filename>
git commit --amend --no-edit 

If you make a:

git log --graph --all --stat --decorate
It will show up only your last commit with both changes in it. The prevois and the last commit.

Please do only use that on your local history. History manipulation on remote repositories breaks codebases and causes trouble in your dev-team

Keine Kommentare:

Kommentar veröffentlichen