right way to create a new branch

ghiboz May 28, 2013

hi all! I had a problem creating a new branch and after go back to the previous:

I've created a new branch called dev_NP from my branch dev, after I've used dev_NP and the next commit are all of dev_NP.

on the website I see that all the old commit have both dev and dev_NP:

today I checked out my dev branch to continue to work in dev, but it mantained also the changes made in dev_NP, so I made some bad things with git reset git revert...

how can I do this in the right way?

thanks in advance

5 answers

0 votes
ghiboz May 29, 2013

thanks steve!

but is right that when you create a new branch, in bitbucket website you see the label 'new_branch' also for the old commits and when you commit in the 'new_branch' you see also the label of the other branch?

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 29, 2013

Yes, it's because they are 'reachable' from that branch I believe. You'd have to ask the Bitbucket guys for more detail on that design decision :)

0 votes
ghiboz May 29, 2013

here is the shoot

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 29, 2013

That looks completely normal to me. The Bitbucket view should only show the branch alongside the commit if the commit is reachable from that branch - the only thing I can think of is that you did some kind of history modification (like reset to commit) but after you'd already pushed those commits, then you pushed them again? Hard to visualise how this view matches up since I can only see part of your BB list in the previous screenshot.

0 votes
ghiboz May 28, 2013

I'll do it at home, here is modified after the git reset and git revert, but the graph is a single line

0 votes
ghiboz May 28, 2013

Hi Steve!

In my project I worked on the 'dev' branch.

after I've created a new branch called 'dev_NP' from the last commit of 'dev' branch.

after this, all the 'dev_NP' commits are referenced in the bitbucket website like the image that I posted, 'dev' and 'dev_NP'.

Today I decided to come back to the 'dev' branch and leave the 'dev_NP' branch, so I checkout the 'dev' branch, sourcetree told me that the actual branch was 'dev' but it mantained all the commits that I made in 'dev_NP'

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 28, 2013

Yeah, that doesn't sound normal - if you created a new branch dev_NP and checked it out, any new commit would have been associated with that branch, and checking out 'dev' again should have taken you back to the previous point in time. Can you show us a screenshot of SourceTree's graph?

0 votes
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 28, 2013

I think to advise you we need a clearer understanding of what it was you were trying to achieve - can you explain?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events