Skip to content

Working on same file in different branches, keeping branches seperated and clean #21765

Discussion options

You must be logged in to vote

It’s because you didn’t change the branch between your work on issueA (including the push) and creating the new branch. If you are on the issueA branch and do

$ git checkout -b issueB

the issueB branch will start at the latest commit on the issueA branch. That’s the problem.

You have two ways to solve that (examples assuming you want to start from master):

  1. Change to the right branch before creating the new one:
    $ git checkout master
    $ git checkout -b issueB
  2. Use the optional “start point” argument to checkout when creating the branch:
    $ git checkout -b issueB master

Either way your new branch “issueB” will start at the current state of “master”. You can use a commit ID instead of a branc…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Dharmil-Shah3
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants