cool hit counter Github Learning Documentation-3_Intefrankly

Github Learning Documentation-3

Kissing GitHub.jpg

1 Git's Basic Commands

After learning these basic Git commands, you'll be ready to play around on GitHub all by yourself. Git has a lot of the same commands as Linux. For example, you can create folders and files with Git in the same way as you can with Linux, and there's a Vim editor in Git that's just like Linux. The following Git commands all have the feature that they start with git at the beginning of the command. All of these Git commands are very common word combinations, and after using them a few times, it's only natural that you'll remember them, so read on.

  • git init

To initialize a repository, you can use the Git (again, Git is just a tool) tool to turn a project's files into a version-controlled repository with a "repository manager." Look closely at the dynamic image below, and you'll see that after you initialize the repository, there's an extra path (master) on the command line, which is the master branch flag for a repository. You won't notice anything extra inside your folder directly after this command, but the contents are actually in a hidden state and are actually there. Here's what you can do to display a list of files from the Git command line ls // View the list of files in the folder ls -a // View all files in the file, including hidden files , ./ folder represents the current directory, ... The /folder represents the parent directory, i.e. the parent directory.


  • git status

Check the status of each file in your current repository. This is a common command, especially if you're new to Git, and using it more often to see the feedback Git gives you will help you understand it better. For more information on the four states of files in the repository, you can go to subsection 4.2 of Handholding GitHub if you can't remember.


  • git add .

git add . Adding a little (.) to the end means that you are adding the contents of all the files in the workspace to the staging area to "track them up", so if you only want to add one of the files to the staging area, then just replace the (.) with your file name. After this command you can use git status Check the status of the current repository file and look for the difference between the file status in this image below and this image above.


  • git commit -m "Submit a help note for this document"

The git add command above puts the file in the staging area and keeps track of it, but this git commit command actually "controls" the file.


Here, the work in your local repository is done, isn't it quite simple, just a few commands. Next we're going to build the remote repository, which is back on our GitHub site.

2 Create a remote repository on GitHub

By doing the above, we already have a local repository, at this point we have to create a GitHub remote repository, first open our GitHub website personal home page, open Repository (repository), there is a new repository button inside, of course there are other places on the website also can be a new repository button.

Create a new GitHub repository.png

Instructions for creating a repository.png

In network security, https is the encrypted transmission method, and https is also used on GitHub to establish a connection between local and remote repositories, which is also relatively simple and commonly used. However, the first time you establish a connection, you will need to enter your GitHub username and password. The other is the ssh key method. ssh uses RSA, which is asymmetric encryption, and requires the ssh key to be generated locally (by typing in the command) and the public key to be stored on GitHub. If you use this method, you don't need to enter your GitHub username and password to be able to use the ssh key on your local computer. But let's use the https method for now, and we'll get to ssh later.

New warehouse finished.png

By this point, we have our remote repository built, so let's get down to business!

3 Git and GitHub Kiss

Start by opening up our Gitbash command line window. origin represents our local repository, and the https address after origin is the one we just copied from the GitHub site.

  • git remote add origin https://...

Local repository and remote repository kissing.png

  • git remote -v

On linux, you don't get a message when a command succeeds, you get a message when an error is reported, and this is also true on the Git bash command line, which allows you to see which remote you are currently connected to.

View connection information.png

  • git push -u origin master

With this command, you can push the contents of the local repository to the remote repository. For the first push, it is recommended to add -u between push and origin, but there is no problem without it. It's actually a good command to remember, push push origin local repository alias master master branch.

First commit to remote repository.png

Submit to remote repository successful.png

After running this command, wait for Git to commit the contents of your local repository to the remote repository, refresh your GitHub site repository, and see if the contents are the same as your local repository.

Refreshing the GitHub website.png

Up to here you can modify the content in your local repository and then commit them to the remote repository after. We can see the benefit of Git in that we can still do version control in my local repository when we don't have internet, and we can commit our local repository to GitHub's remote repository when we do have internet. If you want to be proficient with Git, you need to use Git more often. It's normal to have problems. The commands in this document are basic, common commands, and it's impossible to fix the errors that occur when using Git. Let's learn a few commands in common use below.

  • git log

To view the submitted records, you can also use thegit log --onelineto see a concise version of the commit log, we can also use the --graph option to see when branches, merges have occurred in the history, a command that will also be used in Keeping Up with github.


  • git --help

See all command usage help for git, plus you can add -h (short for --help) to the command after git to see all command usage help for that command, such as git add -h, and you can try usage help for other commands as well.



At this point, you should be able to use GitHub to upload your notes or code that you normally write to GitHub using Git, so go ahead and try it out. It's normal to encounter problems. If you have problems following the above, please feel free to give me questions.

1、Be careful what you post machine vision inferring your family members with full 175page ACMMM PDF download
2、Tuple Common Operations
3、R visualization chart nesting parentchild charts
4、Crossplatform player implementation based on ffmpeg
5、Baidu Mobile Assistant and 35 other apps on the Ministry of Industry and Information Technologys blacklist

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送