I notice when I rebase and have a merge conflict, it has the staged changes for the current commit, so it is easy to find what was done in the commit and change it, but then you can also just do 'git rebase --continue' and it will apply the change with the same commit message as before.
Is there a way to force this to happen for specific commits, or all commits, so I can easily rebase and edit the previous changes I made to work with the changes I have rebased on? It seems like this would be much easier than just setting edit on all the commits and then doing 'git reset --soft HEAD~', so that the changes are visible and I can check they make sense for the new HEAD, editing, and then having to do 'git commit -m "message" '.
My use case is that the repository I am working with has had its file structure heavily refactored and git is unable to make the appropriate changes, but says the merge is successful.
Thanks!
For each change you make, you'll need to perform a new commit, and you can do that by entering the git commit --amend command. When you're finished making all your changes, you can run git rebase --continue . As before, Git is showing the commit message for you to edit.
To check out the original branch and stop rebasing, run "git rebase --abort".
By replacing the command "pick" with the command "edit", you can tell git rebase to stop after applying that commit, so that you can edit the files and/or the commit message, amend the commit, and continue rebasing.
I think what you are looking for is interactive rebasing and rewriting git history. It will let you squash commits as well as change the commit messages.
git rebase -i branch # <branch> should be the parent branch i.e. develop/master
Rewriting git history
# for instance
>>> git rebase -i branch
pick 8705209 first
edit 7979797 second # Use edit wherever you want to view and edit commit
squash 9793757 third # Use squash to squash commits into the previous one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With