GitHub's usage record

Source: Internet
Author: User
Tags hosting git shell

Objective:

This post for the author in the use of GitHub in some of the use of attention, and git basic commands, will always record the author in the use of GitHub errors and solutions (will always be updated), for some git beginners reference, if there is no details or wrong place, Please do not hesitate to comment on your comments, the author and the reader to learn progress together.

This blog post is the following part of the main information, due to information security issues, not all display, please forgive the reader.

For git installation and account configuration, this article will not tell, readers can own Baidu.

1. Upload your locally developed documents to git for hosting

Create a project engineering on git first

  

Builds the project's hhts or SSH project path on git

  

Copy the URL use the git clone command in a git shell to download the project to a local

  

Create a folder for the project in a locally configured Git repository with a. Git hidden folder in the folder

  

Put the code you have developed into that directory

  

Switch to git Shell, switch to the GIT project path with the CD command, and notice that the branch is consistent

You can use the git add command to load all the files into git, and if you add files separately, you can use the command git add filename to add, and filename can be separated by a space.

Then use the git commit command to upload the added file to git,-m to record the history, and git must write the information history

Finally, use the git push command to sync to the GIT remote server and note that the branch is master

2. Upload the modified code to GIT

After modifying the code, you need to upload the modified code to git hosting, before uploading, it is best to use the git status command to view the local modification records, will show the modified, increased, not added file information

  

Then use the git pull command to synchronize the code on the remote service locally to prevent a conflict on upload

  

Then use the git comit command and the git push command to upload the modified code to the GIT remote server

3. Update the code on the GIT remote server

Use the Git pull (Origin master) command to update the remote server's code to the local repository

  

4. Update the code on the GIT remote service, but the organization has changed

After we modify the organization or display permissions of the code, we may get an error when using the git pull command, saying that we can not find git, we could use the GIT branch command to look at the branch, make sure the branch has been, and then use Git remote-v to look at the remote version of Git.

  

The GIT path that you said on the error may be inconsistent with the print here, we need to modify the local path to the GIT path on the remote server, and you can use the GIT remote set-url [options] HTTPS command.

  

You can then update the code with the git pull command.

  

5. View history

You can use the git log command to view all history, or you can specify the number of historical entries to view, and use Git log-1 to view the oldest record

  

GitHub's usage record

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.