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

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.

主站蜘蛛池模板: 靖宇县| 临清市| 沈阳市| 柘荣县| 河间市| 稻城县| 汨罗市| 内丘县| 巴东县| 鄂托克旗| 乡城县| 东乡族自治县| 米泉市| 徐汇区| 杂多县| 呼伦贝尔市| 隆昌县| 社会| 介休市| 富阳市| 江安县| 元阳县| 同德县| 河东区| 仙游县| 宜州市| 儋州市| 金昌市| 安阳市| 安远县| 磐安县| 崇礼县| 黄龙县| 新田县| 三亚市| 磐石市| 柳河县| 高邑县| 佛坪县| 崇仁县| 梁山县|