Reputation: 110630
Is it possible for me to 'git commit --amend' 2 commits AFTER I have pushed?
git commit
git push
git commit
git push
Can I some how combine the 2 commits that I did?
Thank you.
Upvotes: 1
Views: 884
Reputation: 467901
The answer to this depends on whether it's OK for you to "force push" to your repository - in other words to push a commit that doesn't contain the remote branch as part of its history. For example, it's certainly OK for you to force push if one of the following applies:
If so, then you could go ahead and do the following:
# Reset the master branch pointer to the commit before, but leave the index
# and your working tree as is:
git reset --soft HEAD^
# Amend the commit you're now at with the current index:
git commit --amend
# Push the master branch with '-f' for '--force':
git push -f master
Upvotes: 5
Reputation: 185801
I believe you mean "amend", not "append". In any case, while it's certainly possible to do anything you want, it's a rather bad idea to go modifying history (which amend does) once you've pushed.
Upvotes: 1