If you’re using the terminal, you will use the git branch command followed by your desired branch name to create a Git branch in your repository.
It should look something like this:
git branch feature-A
This will create a Git branch on your currently checked-out reference.
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
at any point during your workflow.
Merging branches in Git is useful for combining changes from one branch into another, and for preserving history.
Let’s say you have a master branch with changes. You then branch off into a feature branch and make additional changes.
To merge the feature branch, you will want to first checkout…
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.
Originally published at https://gitkraken.com.
Before you get into deleting remote branches in Git, we recommend you familiarize yourself with how to delete local branches.
Deleting a remote branch works a bit differently than deleting a branch locally in Git.
If you run the git branch -d command associated with a remote branch, Git will…
At its core, the branching model offered by Git is intended to help you avoid merging unstable code into the main codebase. Working with branches in Git is a breeze, especially if you’re working with the GitKraken Git client to visualize your repository.
Let’s start by going over how to…
What does ‘diff’ mean in Git? In this beginner Git tutorial, we will walk you through the concept of a diff and the benefits of using a robust diff tool, like that offered in the GitKraken Git GUI.
A diff takes two data sets and shows you what has…
What is interactive rebase in Git? And how does one rebase interactively? 🤔In this advanced Git tutorial, we will go over everything you need to understand what interactive rebase is, how to confidently utilize the feature in GitKraken, and an example of how interactive rebase works in Git.
The various methodologies that have popped up in the last decade related to software project management are overwhelming. How many roadmaps do we need to encourage successful software development, innovation, and faster deployment?
Widespread project management styles include Waterfall, Agile (scrum, kanban, hybrids), Rapid Application Development (RAD), Six Sigma, and…