![]() In the "Create a Branch" window, under "Name", type the name of the new branch. If you have more than one branch, you can choose to base the new branch on the currently checked out branch or the default branch.Īt the top of the app, click Current Branch and then in the list of branches, click the branch that you want to base your new branch on. Tip: The first new branch you create will be based on the default branch. For more information, see " About protected branches." Creating a branch Repository administrators can enable other protected branch settings to enforce specific workflows before a branch can be merged. If you're working on a branch that's protected, you won't be able to delete or force push to the branch. ![]() Repository administrators can enable protections on a branch. You can always create a branch in GitHub Desktop if you have read access to a repository, but you can only push the branch to GitHub if you have write access to the repository. For more information, see " Creating an issue or pull request from GitHub Desktop" and " About pull requests." ![]() Once you're satisfied with your work, you can create a pull request to merge your changes in the current branch into another branch. This can be helpful if you need to return to an earlier view of the repository to investigate a bug, or to create a hot fix on top of your latest release. You can also create a branch starting from a previous commit in a branch's history. ![]() You can then work on this new branch in isolation from changes that other people are making to the repository. Typically, you might create a branch from the default branch of your repository. You always create a branch from an existing branch. For example, you could use a branch to develop a new feature or fix a bug. Branches isolate your development work from other branches in the repository. Remotes/origin/master 56eddd1 Add new contact form pageĪfter having created that new remote branch like this, updating it with new local commits that you create in the future is easy: simply call the "git push" command with no options as we did in our earlier example.Īnyone with access to your remote repository can now also start working on "contact-form": he can create a local branch on his machine that tracks this remote branch and also push changes to it.You can use branches to safely experiment with changes to your project. Remotes/origin/contact-form 56eddd1 Add new contact fo. Remotes/crash-course-remote/master 2b504be Change headlines f. Remotes/crash-course-remote/faq-content e29fb3f Add FAQ questions Master 2dfe283 Implement the new login box * contact-form 56eddd1 Add new contact.įaq-content 814927a [crash-course-remote/faq-content: ahead Performing the "git branch" command with a special set of options also shows us the tracking relationships in square brackets: $ git branch -vva The "-u" flag establishes a tracking connection between that newly created branch on the remote and our local "contact-form" branch. This command tells Git to publish our current local HEAD branch on the "origin" remote under the name "contact-form" (it makes sense to keep names between local branches and their remote counterparts the same). * contact-form -> contact-formīranch contact-form set up to track remote branch contact-form from origin. To file://Users/tobidobi/Desktop/GitCrashkurs/remote-test.git Let's share our "contact-form" branch (which hasn't been published until now) on the "origin" remote: $ git checkout contact-form This means that it's perfectly possible to keep some of your work private while sharing only certain other branches with the world. Learn on: Desktop GUI | Command Line Language: EN | CN Publishing a Local BranchĪ local branch that you create on your machine is kept private to you until you explicitly decide to publish it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |