Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Code Block
// Get a list of branches in the repository
git branch

// Create a new branch
git branch my-branch

// Switch to a branch
git checkout my-branch

// A shorthand for two previous commands (create and switch)
git checkout -b other-branch 

// Delete a branch
git branch -d my-branch
// Get a remote branch
git checkout -b <local_branch_name> <remote>/<remote_branch_name>
// The names for "my-local-branch" and "my-remote-branch" are usually the same
git fetch
git branch --all
git checkout -b my-local-branch origin/my-remote-branch