Skip to content

Commit 41b6951

Browse files
committed
Add tutorial of GitHub branches page
Describe how to work with the GitHub branches page: - [x] Basic comparing - [x] *Hidden* - How to change the base branch. Something otherwise available only locally. - [x] Show the merged branches.
1 parent e1d7215 commit 41b6951

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ A collection of cool hidden and not so hidden features of Git and GitHub. This c
1111
- [Adjust Tab Space](#adjust-tab-space)
1212
- [Commit History by Author](#commit-history-by-author)
1313
- [Cloning a Repository](#cloning-a-repository)
14+
- [Compare all branches to another branch](#compare-all-branches-to-another-branch)
1415
- [Comparing Branches](#comparing-branches)
1516
- [Compare Branches across Forked Repositories](#compare-branches-across-forked-repositories)
1617
- [Gists](#gists)
@@ -98,6 +99,34 @@ $ git clone https://github.com/tiimgreen/github-cheat-sheet
9899

99100
[*Read more about the Git `clone` command.*](http://git-scm.com/docs/git-clone)
100101

102+
### Compare all branches to another branch
103+
104+
If you go to (click the branches link next to commits):
105+
106+
```
107+
https://github.com/{user}/{repo}/branches
108+
```
109+
110+
You would see a list of all branches which are not merged into the main branch (e.g. `master`).
111+
112+
You could go to the compare page or delete a branch with a click of a button.
113+
114+
![Compare branches not merged into master in jquery/jquery repo - https://github.com/jquery/jquery/branches](http://i.imgur.com/gKWPe8a.png)
115+
116+
However often you need to compare branches to a branch other than `master` (e.g. `development`). Just append the name of the branch to the URL like so:
117+
118+
```
119+
https://github.com/{user}/{repo}/branches/{branch}
120+
```
121+
122+
![Compare branches not merged into `1.x-master` in jquery/jquery repo - https://github.com/jquery/jquery/branches/1.x-master](http://i.imgur.com/jpc6Urb.png)
123+
124+
If you want to see the merged branches you need to append `?merged=1` to the URL. There is a link of that on top.
125+
126+
![Compare branches merged in to `1.x-master` in jquery/jquery repo - https://github.com/jquery/jquery/branches/1.x-master?merged=1](http://i.imgur.com/KmYyCVh.png)
127+
128+
This view is very nice if you want to find yout which branches to delete (and delete them right from the page) right on GitHub.com.
129+
101130
### Comparing Branches
102131
To use GitHub to compare branches, change the URL to look like this:
103132

0 commit comments

Comments
 (0)