GitHub took action based on the Conservancy's suggestion and moved away from the term master when a Git repository is initialized, "We support and encourage projects to switch to branch names that are meaningful and inclusive, and we'll be adding features to Git to make it even easier to use a different default for new projects." As a result, GitHub renamed the master branch to main branch. "Both Conservancy and the Git project are aware that the initial branch name, 'master,' is offensive to some people and we empathize with those hurt by the use of that term," said the Software Freedom Conservancy. Amid the many protests and the growing social unrest, these harmful and antiquated terms were no longer considered appropriate. The computer industry's use of the terms master and slave caught everyone's attention in the summer of 2020. Additionally, I believe we can change our default in BitBucket to main.įrom The Server Side: Why GitHub renamed its master branch to main: Cultural sensitivity I have renamed master to main several times and it is not difficult. One an article from ZD-NET, another from TechRepublic, and a third from The Server Side. I have included three links on this topic. There are nuances to how Git branching works depending on the point at which you want to fork the code base, how the repository maintainer manages branches, squashing, rebasing, and so on.Throughout many technology companies there has been a movement to eliminate divisive language in favor of non-divisive language, this includes eliminating the use of terms that were inappropriately and offensively taken from slavery including the elimination of the term master in favor of main. Refs/remotes | grep Get good at branching You can use grep to get the author of a specific remote topic branch: $ git for-each-ref -sort=authordate \ You can add further formatting, including color coding and string manipulation, for easier readability: $ git for-each-ref -sort=authordate \ List the author of all the remote topic branches in the repository, using the -format option along with special selectors (in this example, %(authorname) and %(refname) for author and branch name) to print just the information you want: $ git for-each-ref -sort=authordate -format='%(authorname) %(refname)' refs/remotesĮxample output: tux refs/remotes/origin/dev Delete branch references to remote branches that do not exist: $ git remote prune originģ. If you are the repository manager, you might need to do this so you can inform the author of an unused branch that it should be deleted.Ģ. Delete the remote branch: $ git push origin -d Find the author of a remote topic branch using Git List all branches (local as well as remote): $ git branch -aģ. Checkout the central branch of your repository (usually main or master): $ git checkout Ģ. Should you decide that you didn't want to delete the branch after all, you can re-push it to the remote, such as GitHub, as long as you still have your local copy.ġ. To remove all your local topic branches and retain only the main branch: $ git branch | grep -v main | xargs git branch -d Delete a remote branchĭeleting a remote branch only deletes the copy of that branch that exists on the remote server. Delete the local branch: $ git branch -d List all the branches (local as well as remote): $ git branch -aģ. Checkout the central branch of your repository (such as main or master): $ git checkout Ģ. If the branch has already been pushed to the remote repository, it remains available to everyone working with the repo.ġ. Delete a local branchĭeleting a local branch only deletes the copy of that branch that exists on your system. Delete the old remote branch: $ git push origin -d -f Delete local and remote branches using GitĪs part of good repository hygiene, it's often recommended that you delete a branch after ensuring you have merged the content into the main branch. Rename the current branch: $ git branch -m ģ. When the branch you want to rename is your current branch, you don't need to specify the existing branch name.ġ. Delete the old remote branch: $ git push origin -d -f Rename the current branch Push the new branch to create a new remote branch: $ git push origin ģ. If the branch exists on the remote Git server, continue to the next steps.Ģ. Of course, this only renames your copy of the branch. Rename the local branch: $ git branch -m Renaming a topic branch is useful if you have named a branch incorrectly or you want to use the same branch to switch between different bugs or tasks after merging the content into the main branch. New Git articles Rename a branch using Git
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |