Smartgit default squash date11/6/2023 ![]() ![]() ![]() Since I am apprehensive about running scripts which depend on setting and unsetting environment variables to rewrite git history, I am writing a new answer based on this post which is similar to this answer but is more complete. More generally, it does not work when handling messy histories. The accepted answer to this question is a wonderfully clever use of interactive rebase, but it unfortunately exhibits conflicts if the commit we are trying to change the author of used to be on a branch which was subsequently merged in. Use git push -f to update your origin with the updated commits. ![]() Then you would git commit -amend -author="Author Name " again.You would git commit -amend -author="Author Name ".Once the rebase started, it would first pause at C.Exit the editor (for vim, this would be pressing Esc and then typing :wq).Change the lines for both C and D from pick to edit.if you need to edit A, use git rebase -i -root.Specify git rebase -i B ( here is an example of what you will see after executing the git rebase -i B command).Then when git prompts you to change the commit, use this: git commit -amend -author="Author Name " -no-editįor example, if your commit history is A-B-C-D-E-F with F as HEAD, and you want to change the author of C and D, then you would. In the list of commits being rebased, change the text from pick to edit next to the hash of the one you want to modify. Interactive rebase off of a point earlier in the history than the commit you need to modify ( git rebase -i ). ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |