Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between checkout existing and checkout new branch in Sourcetree

In sourcetree I would like to just check out to the remote develop branch so I can start a new feature branch in there. I'm currently in another feature branch in which I have committed and pushed all my changes.

However when I right click on remote branch origin/develop I get this: enter image description here

For some reason I can find nowhere what is the difference here. I don't want to break the repo at my new job, so I'm super careful. In GitKraken you just checkout to remote and update your local develop branch if necessary.

like image 688
Steve Waters Avatar asked Nov 24 '25 19:11

Steve Waters


1 Answers

What this does is:

git checkout -b develop --track origin/develop

That will make sure the local branch develop will push to, by default, the remote branch origin/develop.

Note that with Git 2.23+, that would be git switch

git switch -c develop --track origin/develop

SourceTree has not yet integrated that new command.


I don't want to break the repo at my new job, so I'm super careful

That won't break anything: this is a local operation only.


This differ from "Checkout existing", which will only list existing local or remote branches, making it the equivalent of:

git switch <branch>
like image 113
VonC Avatar answered Nov 26 '25 14:11

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!