About managing branches
You can use branches to safely experiment with changes to your project. Branches isolate your development work from other branches in the repository. For example, you could use a branch to develop a new feature or fix a bug.
You always create a branch from an existing branch. Typically, you might create a branch from the default branch of your repository. You can then work on this new branch in isolation from changes that other people are making to the repository.
You can also create a branch starting from a previous commit in a branch's history. 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.
Once you're satisfied with your work, you can create a pull request to merge your changes in the current branch into another branch. For more information, see "Creating an issue or pull request from GitHub Desktop" and "끌어오기 요청 정보."
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.
리포지토리 관리자는 분기에서 보호를 사용하도록 설정할 수 있습니다. 보호되는 분기에서 작업하는 경우 분기를 삭제하거나 강제로 푸시할 수 없습니다. 리포지토리 관리자는 분기를 병합하기 전에 다른 보호된 분기 설정을 사용하여 특정 워크플로를 적용할 수 있습니다. 자세한 내용은 "보호된 분기 정보.
Repository administrators can also enable rulesets. Rulesets can be used to require specific branch names when creating a new branch, or to allow only users with bypass permissions to publish a new branch to the remote repository. GitHub Desktop will show a warning and prevent the branch from being created if the branch does not follow the rulesets. For more information, see "규칙 집합 정보."
Creating a branch
Tip: The first new branch you create will be based on the default 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.
-
앱 맨 위에서 현재 분기 를 클릭한 다음 분기 목록에서 새 분기를 기반으로 할 분기를 클릭합니다.
-
새 분기를 클릭합니다.
-
"분기 만들기" 창의 "이름" 아래에 새 분기의 이름을 입력합니다.
-
"기반으로 분기 만들기..."에서 새 분기의 기본 분기를 선택합니다.
-
분기 만들기를 클릭합니다.
Creating a branch from a previous commit
-
왼쪽 사이드바에서 기록을** 클릭합니다**.
-
Right-click on the commit you would like to create a new branch from and select Create Branch from Commit.
-
"분기 만들기" 창의 "이름" 아래에 새 분기의 이름을 입력합니다.
-
분기 만들기를 클릭합니다.
Publishing a branch
If you create a branch on GitHub, you'll need to publish the branch to make it available for collaboration on GitHub.
- In the repository bar, click Current Branch, then click the branch that you want to publish.
- Click Publish branch.
Switching between branches
You can view and make commits to any of your repository's branches. If you have uncommitted, saved changes, you'll need to decide what to do with your changes before you can switch branches. You can commit your changes on the current branch, stash your changes to temporarily save them on the current branch, or bring the changes to your new branch. If you want to commit your changes before switching branches, see "Committing and reviewing changes to your project in GitHub Desktop."
Tip: You can set a default behavior for switching branches in the Advanced settings. For more information, see "Configuring basic settings in GitHub Desktop."
- In the repository bar, click Current Branch, then click the branch that you want to switch to.
- If you have saved, uncommitted changes, in the "Switch Branch" window, select Leave my changes on CURRENT-BRANCH or Bring my changes to NEW-BRANCH, then click Switch Branch.
Deleting a branch
You can't delete a branch if it's currently associated with an open pull request. You cannot undo deleting a branch.
- 리포지토리 표시줄에서 현재 분기를 클릭한 다음 삭제할 분기를 클릭합니다.
- 메뉴 모음에서 분기를 클릭한 다음 삭제... 를 클릭합니다. Shift+Command+D를 누를 수도 있습니다.
- 리포지토리 표시줄에서 현재 분기를 클릭한 다음 삭제할 분기를 클릭합니다.
- 메뉴 모음에서 분기를 클릭한 다음 삭제... 를 클릭합니다. Ctrl+Shift+D를 눌러도 됩니다.
Further reading
- "GitHub에서 GitHub Desktop으로 리포지토리 복제"
- "GitHub 용어" in the GitHub glossary
- "분기 정보"
- "Branches in a Nutshell" in the Git documentation
- "Stashing changes in GitHub Desktop"