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

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.

主站蜘蛛池模板: 沾益县| 泽库县| 锦州市| 家居| 八宿县| 姜堰市| 田东县| 上虞市| 会宁县| 灵山县| 甘南县| 永宁县| 得荣县| 塘沽区| 辽中县| 灵宝市| 台北市| 东海县| 沾化县| 和平县| 冀州市| 津南区| 长子县| 海口市| 汉沽区| 阿荣旗| 满城县| 诸城市| 吉首市| 丘北县| 文安县| 同心县| 水富县| 陕西省| 耿马| 怀宁县| 虹口区| 隆化县| 集贤县| 哈巴河县| 景泰县|