it:ad:visual_studio:sc:git:howto:create_branches

IT:AD:Visual Studio:SC:Git:HowTo:Create Branches

Summary

Making branches is required to allow for setting up the equivalent of gated checkins, using Git.

To prevent unexpected issues, checkin (or stash) your work before creating new branches – which might automatically switch branch (at least in 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 choose New 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 checkin or stash of your work

    leave the Checkout check box checked.

  • Create Branch

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

  • /home/skysigal/public_html/data/pages/it/ad/visual_studio/sc/git/howto/create_branches.txt
  • Last modified: 2023/11/04 02:51
  • by 127.0.0.1