IT:AD:Visual Studio:SC:Git:HowTo:Create Branches
- See also:
Summary
Making branches is required to allow for setting up the equivalent of gated checkins, using Git.
Process
To prevent unexpected issues,
checkin (or stash) your work before creating new branches – which might automatically switch branch (at least in Visual Studio).
Using Visual Studio
- In Visual Studio
- In Team Explorer
- Go to the Branches view.
- Right-click the parent branch (usually
master) to base your changes and chooseNew Local Branch From....
- Provide the new name (forward slashes create collapsible folders in Visual Studio)
- And which branch to use as a source template
- If you want to automatically switch to that new branch,and you previously performed a
checkinorstashof your workleave the Checkout check box checked.
- Create Branch
Using the Command line
If you like bare metal (and who doesn't, right), skip the UI and do it using the following commands:
# what branches are here git branch # create a new branch git branch newbranch # switch to new branch git checkout newbranch # rename a branch git branch -m oldname newname # in case you need to delete a branch git checkout master git branch -d newbranch

