官术网_书友最值得收藏!

The branches page and a comparison with the git branch command

Let's create a branch named add_description and checkout into it:

git checkout -b add_description

Next, edit README.md, add some text, make a new commit, and push it to GitHub:

echo "\n## Description\n\nGitHub for dummies" >> README.md
git add README.md
git commit -m "Add second level header to README file"
git push origin add_description

Now let's create a second branch named new_feature out of the master branch and just push it to GitHub:

git checkout master
git branch new_feature
git push origin new_feature

Now its time to switch to GitHub and see how all this information is presented.

In the main repository page, you can now see that there are three branches. Click on the branch link to get more information.

The Overview page is, as the title suggests, an overview of the other tabs you see next to it. It tells us what the default branch is, what branches you have pushed from your account (same as the Yours tab), and the most active branches in the last three months, sorted by date (same as the Active tab). The Stale tab represents the branches that haven't been updated for more than three months.

You can change the default branch that appears on your project's homepage in the project's settings. This is covered in detail in Chapter 6, Exploring the User and Repository Settings.

You may notice that although we pushed the new_feature branch after we pushed add_description, its update time appears to be before add_description. This is only natural, since new_feature has the same commit date as our master branch, which is dated before the add_description branch.

Now, if you look closely at the tab where the branches are shown, you can see, written in a small font, the number of commits that the branches are behind or ahead of the default branch by—in our case, the default branch is master.

From the branches page, you can delete all the branches, except for the one you have set as default. Let's try and delete the new_feature branch. Click on the red trash icon and watch what happens. GitHub gives you the chance to restore a recently deleted branch:

If you refresh the page or browse in another area of the page where you deleted the branch, the Restore button will disappear.

The New pull request button will be explored in a different chapter.

主站蜘蛛池模板: 古蔺县| 阿克陶县| 曲沃县| 棋牌| 邛崃市| 平遥县| 镇巴县| 崇文区| 兴国县| 蒲江县| 札达县| 灯塔市| 额尔古纳市| 霍州市| 泰来县| 东安县| 信阳市| 临高县| 若羌县| 肥乡县| 镶黄旗| 崇礼县| 牙克石市| 天长市| 光泽县| 元氏县| 绩溪县| 宁蒗| 黄龙县| 陇南市| 名山县| 三明市| 新安县| 宁安市| 嘉峪关市| 肥城市| 威宁| 西平县| 苏尼特右旗| 仙桃市| 临泉县|