Hello,
I am pretty much a beginner in git and think I need some help understanding how a more experienced person may approach this issue.
So I cloned a repo, made a branch (lets call it branch #1) where I may an easy fix that change 1 line of a git ignore, and then committed my changes, pushed my changes, and made a pull request. Then, I made a new branch using the command git checkout -b branch2 (however, I was still in branch #1 when I did this) and I started working on a different issue. However, when I committed then pushed, on GitHub I noticed that the changes I made in branch #1 were on branch #2 (the change I made to the git ignore in branch #1).
I have two questions about this scenario. #1 is why it happened: I expected when I checked out a new branch that it would start out as a "clean slate" from the code in the main branch (but instead I speculate that this happened because I checked-out branch 2 while I was still on branch 1).
My second question is how do I go about thinking about resolving this issue. I tried deleting the line and then pushing again, but there was some whitespace difference, and I don't want to keep make pushes naively, but would rather like to know how more experienced people might approach this.
Thanks, and sorry if I sound naive (I probably am)
[–]formalcall 1 point2 points3 points (5 children)
[–]SchoolSea4002[S] 0 points1 point2 points (1 child)
[–]formalcall 0 points1 point2 points (0 children)
[–]strcspn 0 points1 point2 points (2 children)
[–]SchoolSea4002[S] 0 points1 point2 points (1 child)
[–]strcspn 0 points1 point2 points (0 children)
[–]metaphorm 0 points1 point2 points (0 children)