Reputation: 4440
If I want to create a new local branch from remote branch release/A
. I know I can do this
git checkout release/A
git checkout -b feature/A1
and I will have feature/A1
checked out and ready for changes.
But I grow tired of having to issue two commands to do this. I could make a script to do this but git has so many tricks I wondered if there might be a way to do this in one command. I tried
git checkout -b feature/A1 origin/release/A
and it does create local branch feature/A1
but also gives it a tracking branch against origin/release/A
, which is not something I want. I will never update release/A
directly; ultimately I would push feature/A1
to remote before issuing a pull request against release/A
.
To clarify; is there a single command that does the same as the following two commands?
git checkout release/A
git checkout -b feature/A1
Upvotes: 1
Views: 63
Reputation: 265595
Simply provide --no-track
to checkout:
git checkout -b --no-track feature/A1 origin/release/A
Upvotes: 3