0

Working in git with limited 8-10 years experience using CVS needing to understand what git repo is doing.

I created a branch off master with changes that I committed and then pushed back to master. Now in the same project I created another branch with a different change to one of the same files. As I go to create a Pull Request for my latest branch B it shows commits from Branch A. Also, my master shows commits from Branch A as though they still need to be pushed. I'd like Branch B to only include the changes I made since creating that branch. Then clear out the commits that are already in master showing they still need to be pushed. How do I do that? Please help.

I have tried

git checkout <branchA>

git rebase master

This was to get this branch to rebase seeing the commits were in this branch. Is there a way a git reset -soft <branchB> would remove the commits from BranchA?

kowsky
  • 12,647
  • 2
  • 28
  • 41
April_Nara
  • 1,024
  • 2
  • 15
  • 39
  • So you've made commits to master in error? And branchA has those same commits? – evolutionxbox Apr 03 '18 at 08:55
  • 1
    Did you branch `Branch B` off from master or from `Branch A`? If it branched off from `Branch A`, it will naturally contain all of its history. – kowsky Apr 03 '18 at 09:18
  • @kowsky I created off of master for a PR with just the new Branch B. – April_Nara Apr 03 '18 at 17:24
  • @evolutionxbox No master should have Branch A merged with (pull request approved). – April_Nara Apr 03 '18 at 17:24
  • Are you using github or some other repository hosting location? – evolutionxbox Apr 03 '18 at 18:24
  • @evolutionxbox Using git repository. I use source control tools and the changes from cmd line. – April_Nara Apr 03 '18 at 19:06
  • Sure thing. You should know that Git doesn’t support pull requests. For that you need a git repo hosting tool. Can you also clarify if you want to replace UAT _completely_ or if you do wish to merge? – evolutionxbox Apr 03 '18 at 19:12
  • @evolutionxbox this is to get in UAT. While it needs to be in master soon User Acceptance Testing would suffice. – April_Nara Apr 03 '18 at 19:16
  • Well your choice is to merge (use both changes), rebase (replay changes onto a branch), or reset (change the UAT branch to be master and forget the UAT branch). – evolutionxbox Apr 04 '18 at 06:58

0 Answers0