GitHub tutorial 08: Work on master branch
Now we have a GitHub repository from master branch. To show which Git commands are required to work on this master branch, here is the plan.
- First, customize Git environment.
- Second, add a file to repository, both local and remote.
- Third, modify the file you just added, and commit it to local repository, then push to remote repository.
Let's start from step 1: Customize Git environment, mainly set your identity. In other words, set user name and email. This is important because every Git commit uses this information. You only need to do it once on any given computer.
To set user name, send command:
$ git config --global user.name "your name".
By the way, the option "global" will save the settings to system and Git can use it for any repository in your system. So you only need to set it once. Of course, you can also use the same command to change the user name anytime.
To check the use name in your system, type:
$ git config user.name.
Next, to set email, send the command:
$ git config --global user.email [email protected]
You don't need to use quotes around the email address.
To check the email address you just set, send command:
$ git config user.email.
To check all the configuration settings in your environment, you can use this command:
$ git config --list.
There are more values you can set using git config command. Please refer to online Git document for details at: git-scm.com. By the way, SCM means source-control management system.
We are ready to add a new file to repository as planned. It involves several steps: adding the file to staging area, committing to local repository, pushing to remote repository. These steps distinguish Git from SVN. In SVN, you commit the change in one step from local to central server. SVN follows a centralized model, and needs internet connection to commit change. In Git, the change has to be added to buffer zone (called staging area), then committed to local repository, finally pushed to remote repository. Git follows a distributed model. You can work offline without any internet connection, and work on local repository as long as you want, till eventually you decide to push all the changes to remote repository.
Let's take a look how this process takes place in live demo.
List the file in the current repository. There is only one file: README.md. You can also verify this in GitHub repository web page.
Create an empty file with your favorite text editor, for example, Notepad, or Notepad++. Name it "demo-01.txt". Click "Yes" to create the file. Check if this file has been created. Yes, it is.
Notice that the Git status summary information has changed. Run "git status" command to view the details. It reminds us to use "git add [file]" to include this untracked file.
Run "git add ." to add all untracked files. Here there is only one. The "." symbol means all files.
Run "git status" again to view the new status.
Run "git commit" to save the new file to local repository. Now Vim editor shows up. Although you can use "-m" option to add comment directly in command line. I prefer to use Vim editor to add comment. It is not hard. You only need to remember several keys. First press key "i" to enter insert mode. You can add comment now: "Added a new file.". Then press Esc, colon ":". Type "wq" for "write" and "quit". That's it. Not hard at all, right? For more options on how to use Vim editor, please search online. For this tutorial, that's all we need to know.
You can also check the comment we just entered with: git log -1. Here -1 means the last comment entry. You can surely use -2, -3 to view more log entries.
Check status again. It reminds us to use "git push" to publish our local commits.
If this is the first time you push change to remote repository, you can run this command to ask Git to store the credential to cache:
$ git config credential.helper store
Now type "git push" and press Enter. A dialog box will show up to ask you to enter account name and password. Do so as required.
The push command should run without incident.
We are not finish yet. To keep the credential cache, for example, 2 hours or 7200 seconds, run this command:
$ git config credential.helper 'cache --timeout 7200'
To double check if we have successfully added the new file to GitHub server, open the GitHub repository page in browser. The new file should show up here.
... (refer to video for details) ...
Try out by yourself till you feel comfortable to this procedure of working with master branch. Then move on to next tutorial. We will start working on development branch, or custom branch.
Thanks for watching!
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «GitHub tutorial 08: Work on master branch», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.