GitKraken

Before you perform actions on your branches in your Git repository, it’s important to know which branch you’re targeting. If you aren’t using a Git GUI, like GitKraken, to visualize your work, it’s likely you won’t be able to remember the names of each local branch, especially in a large Git repository.

To view a list of your local Git branches, you can run

git branch

at any point during your workflow.

--

--

If you have a remote branch, you likely have a local branch with the same name. A typical workflow is to first make commits locally and then push those changes to the remote branch.

However, sometimes you need to push to a different remote branch. To set the upstream branch in Git, use the following command:

$ git push --set-upstream <remote> <branch>

This will push your local branch to the new remote branch.

Additional Learning Git Resources: Git Branch Tutorial | How to Delete a Local Branch | How to Delete a Remote Branch

Originally published at https://gitkraken.com.

--

--

GitKraken

GitKraken

GitKraken, the downright luxurious Git GUI client for Windows, Mac and Linux. GitKraken makes Git commands and processes easy, fast, and intuitive.