- GitHub Essentials
- Achilleas Pipinellis
- 409字
- 2021-08-05 10:45:34
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:

The New pull request button will be explored in a different chapter.
- 計算機組成原理與接口技術:基于MIPS架構實驗教程(第2版)
- 大數據技術基礎
- Google Visualization API Essentials
- Python廣告數據挖掘與分析實戰
- Oracle RAC 11g實戰指南
- Access 2007數據庫應用上機指導與練習
- Learning Spring Boot
- INSTANT Cytoscape Complex Network Analysis How-to
- MATLAB Graphics and Data Visualization Cookbook
- 數據中心數字孿生應用實踐
- 云原生數據中臺:架構、方法論與實踐
- 數據科學工程實踐:用戶行為分析與建模、A/B實驗、SQLFlow
- 二進制分析實戰
- 數據挖掘競賽實戰:方法與案例
- 商業智能工具應用與數據可視化