7/10/2023 0 Comments Git new branchStarting branch name with the category word: Using numbers as a branch name is not a good practice as it needs to be more understandable and increases the confusion and risk of errors.įor example, 12345 as a branch name is not making any sense, and it will lead to mistakes.Ĥ. Avoid using only numbers as a branch name: It helps increase the readability and makes it easy to understand rather than confuse.įor example: Without the separators branch, the name addednewfeature is less readable and more confusing, and by using separators added_new_feature, it is easily understandable.ģ. You can use hyphens, underscores, slashes, or any separators to differentiate between words in a branch name. Use Hyphen(-) or underscore (_) as Separators between different words in a branch name: Long and detailed branch names are not considered a good way of naming.Ģ. The branch name should be short, explanatory, and informative. Avoid having long names for the branches: There are some of the best practices we should follow while naming branches:ġ. Here, we can provide the name of the branch we want to checkout. To switch between different branches of the repository, we can use the command: git checkout The above command will show all the local branches in a repository, along with the * symbol marked in front of the name of the branch we are currently on. If you want to display the total branches in a repository, then you can use the command: git branch When you want to work on a new feature, you create a branch diverging from the main branch using the command git branch new_branch_name. To create a branch in git, we can use the command: git branch Branching also helps in maintaining the stability of the code base. In this way, the development of bug fixes will also be facilitated, and there will be fewer errors as it’s easier to maintain a portion of your work than having large branches having all the code. Branching can be helpful in many terms firstly, we can work on any specific feature in an isolated manner without disturbing the work on the main branch. Any repository can have as many branches, each having a different version of the repository. In git, each branch is a version of any repository, or we can call it the independent line of development. Use to push the committed changes to the main/master branch of the remote repository.īranching is a concept in git which allows us to diverge from the main branch and continue to work in an isolated manner without messing with the main branch. Use to show the current status of the working directory and the staging area Use to commit the staged changes to the remote git repository Use to add untracked files to the staging area Use to create a local, new git repository To apply the concept of branching, we should be aware of the basic commands in git like:
0 Comments
Leave a Reply. |