If you're new to using pull requests and just want to see what steps you should follow, here's my git pull request checklist which you may find helpful. What if you want to keep the branch around so you can always go back and see when it was merged? We'll get to that at the end of this post. When completing a pull request and using auto complete there is a checkbox for Delete after merging It will remember the last setting for the last pull. The current branch will be updated to reflect the. Note that all of the commands presented below merge into the current branch. The git merge command lets you take the independent lines of development created by git branch and integrate them into a single branch. You can create another branch, and even give it the same name, but don't recycle branches you've already associated with a pull request for use with any other work. Merging is Git's way of putting a forked history back together again. Reusing the patch-1 branch (after its original PR has been merged and closed) is a good way to cause problems in your git repository. At this point, the pull request is complete, and future commits should only be made on master, not patch-1. After the merge (assuming a new merge commit is added), both master and patch-1 point to a new merge commit. Before the merge, master and patch-1 both point to separate commits in git's commit history. Consider a scenario in which a branch patch-1 is about to be merged with the master branch through a pull request. They don't add any significant technical overhead, but they make it more difficult for humans to work with lists of branches in the repository.īranches can be safely removed without risk of losing any changes. New branches should be created for each new feature(s) that you work on. If you want to delete remote branches from GitHub, do it in the branches tab or from the command line: git push origin -delete thebranchname. In most cases, branches, especially branches that were related to a pull request that has since been accepted, serve no purpose. In a good workflow, the feature branch is deleted once its merged back into master. Why should you delete old branches from your git repositories? There are two main reasons: It's a common housekeeping practice to delete git branches once they're no longer used, but this practice isn't necessarily universal, or universally understood.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |