In this post, I’ll talk bout one git technique I used in HNGi9 https://zuri.team/ that you must be familiar with, which is branching in Git. The Git branch's strength over other version control systems is by far their biggest advantage. You might be asking what a branch is before I go into the fundamentals of branching. A branch in your repository is a pointer to a commit, which is a pointer to its default branch. However, in essence, it represents a new, independent path of development. While working on my HNGi9 Internship task https://yewande-linktree-duplicate.netlify.app/, I never consciously used branches. By default, Git uses the master branch for development. Any new commits are added to this branch. Branching is necessary for Git to separate lines of work in a project. At a single time, there may be many developers who are working on a variety of different problems. Ideally, these problems are worked on in different branches to ensure logical separation of new code until code review and merge. But in my case, I am the only developer on my task, so I did not require to have multiple branches. Another reason for branches is in order to trace conflict if any occurs. To check a list of branches and the current active branch, run the following command: "git branch", To create a new branch, run the following command: "git branch new_branch". Even though Git creates a new branch, notice that your active branch is still the old one. To start development in a new branch, run the following: "git checkout new_branch", To create a new branch and change the active branch, run the following command: "git checkout -b new_branch". To rename the current branch, run the following command:"git branch -m new_renamed_branch". Use the -D option to remove a branch:"git branch -D new_renamed_branch".
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)