Chapter 5. Work With Branches

Git Regular Workflow – Work With Branches

Git Regular Workflow – Work With Branches
Tag:

The goal of this section is to help you understand how to manage branches, which is one of the most critical concepts of Git operations.

In this section, we'll cover six key git commands.

  • git branch: this command is a multi-use command. For example, it is used for creating a new branch, checking branch status, and deleting an unused branch.
  • git checkout: with this command, you can switch your current branch to a selected branch.
  • git switch: with this command, you can get the same result as with git checkout. It is a newly introduced command used as a substitute for the git checkout command.
  • git merge: with this command, you can merge branches. The merge operation can be done through a Remote Repository on the GitHub website. The merge operation on GitHub will be explained in the next chapter.
  • git rebase: with this command, you can reapply commits on top of another base branch. This command is useful when you want to streamline the commits diverged into multiple branches. The rebase operation can also be done through a Remote Repository on the GitHub website. This is an option of the merge feature of GitHub.
  • git stash: with this command, you can separately manage WIP (Work In Progress) codes. When you want to switch the current branch in the middle of editing the Working Tree, the edits may prevent you from switching the current branch. In that case, this command is useful. The stashed lines of code are parked somewhere temporarily.

The goal of this section is to help you understand how to manage branches, which is one of the most critical concepts of Git operations.

In this section, we'll cover six key git commands.

  • git branch: this command is a multi-use command. For example, it is used for creating a new branch, checking branch status, and deleting an unused branch.
  • git checkout: with this command, you can switch your current branch to a selected branch.
  • git switch: with this command, you can get the same result as with git checkout. It is a newly introduced command used as a substitute for the git checkout command.
  • git merge: with this command, you can merge branches. The merge operation can be done through a Remote Repository on the GitHub website. The merge operation on GitHub will be explained in the next chapter.
  • git rebase: with this command, you can reapply commits on top of another base branch. This command is useful when you want to streamline the commits diverged into multiple branches. The rebase operation can also be done through a Remote Repository on the GitHub website. This is an option of the merge feature of GitHub.
  • git stash: with this command, you can separately manage WIP (Work In Progress) codes. When you want to switch the current branch in the middle of editing the Working Tree, the edits may prevent you from switching the current branch. In that case, this command is useful. The stashed lines of code are parked somewhere temporarily.

Tag: