Reputation: 32031
Lets assume I branched a feature-branch from the master in git. Now I commit some changes to this branch and I think it is ready for the master branch. So I push to the remote repository and use the github UI an issue a pull request from my feature-branch to the master branch.
Now, due to the feedback in the pull request, I need to change some things in my feature branch. I now the simple option to commit the changes as a new commit and push it. If the branch is now merged later on, my feature is splitted into multiple commits.
What are the possibilities if I want to avoid having multiple commits? I see the following possibilities:
git commit --ammend
and append the changes to the current commitgit rebase -i
and squash the changes together into one commitBoth of these solutions have a huge problem: I can't comit anymore without a push -f
.
Question:
push -f
here?push -f
?Upvotes: 0
Views: 182
Reputation: 70863
If your pull request hasn't been accepted as it is, and the discussion has lead to you incorporating feedback, I'd say that your original pull request has been declined and you should prepare a new one if the project you are contributing to has some tighter requirements for pull requests.
Otherwise, you are expected to add new commits to your branch instead of rebasing or amending to already existing commits, push them to github and let the pull request be updated.
This way you will end up with a pull request that has at least two commits: The original one that got discussed, and the commit with the feedback changes.
If the project required pull requests to be one commit only, you have to create a new pull request with all your changed squashed into one commit, and probably rebased onto the new current head of development.
Upvotes: 0
Reputation: 7251
Upvotes: 0
Reputation: 8819
git push -f
away.gitk
and git log
can help.git push -f
is not bad, but you can always create a new branch if you want to keep your old branch as is.Upvotes: 1
Reputation: 363567
git push -f <remove> <branch>
to only force-push one branch.Upvotes: 0