I've been struggling with GIT for a while now since it does some weird things.
I have a base commit with the initial code.
Ok next I make a branch do my edits and commit and push:
git checkout -b feature/feature1
git commit -m "added feature1"
git push origin feature/feature1
Now I do a pull request on that feature.
After that I change branch and update for example:
git checkout -b chore/update-framework
git commit -m "updated framework"
git push origin chore/update-framework
At this point when I try a pull request on the 2nd push, it contains the first commit with all the feature stuff in it. So all the changed files from that commit are in the new pull request, while the old pull request only contains the feature files.
What am I doing wrong?
When you did:
git checkout -b chore/update-framework
You did not checkout on master before.
To start a new branch from the commit you want (example with master):
git checkout -b chore/update-framework master
or:
git checkout master
git checkout -b chore/update-framework
or:
git branch chore/update-framework master
git checkout chore/update-framework
To correct your mistake, you can do:
git rebase --onto master feature/feature1 chore/update-framework
Git will pick all your commits of chore/update-framework which are not pointed by feature/feature1, then it will put them onto master and finally update your chore/update-framework branch.
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