The things about Git.

Source: Internet
Author: User

I used to use TFS or SVN as a code manager, and as GitHub became more and more popular, git users said more and more, and I started to toss git. GitHub connection speed sometimes very slow, at home is not too stable, just see open source China's git storage, feel the speed Genggeng, that he first to do the test.

Open source China's git warehousing (http://git.oschina.net/) and [email protected] (http://team.oschina.net/) are a good choice for combined use.

  

Here is a general record of the next step, there is time to organize

One, using SSH to connect to git storage

1. Configuring Global Variables

git config--global user.name "Your name" here's name will appear in Git's commit record

git config--global user.email "your email" here email will appear in Git's submission record, preferably with [email protected] registered email, easy to manage

2. Create SSH Keys

SSH key allows you to establish a secure encrypted connection between your PC and the Git @ OSC.

2.1, create Sshkey ssh-keygen-t rsa-c "Your Mailbox"

2.2. View the generated Sshkey cat ~/.ssh/id_rsa.pub

2.3, add the sshkey in [email protected], open the Http://git.oschina.net/keys [email protected] SSH Public Key management, add the Sshkey in

2.4, check whether SSH can and [email protected] normal communication, input command: ssh-t [email protected] and then enter, if there is Welcome to [email protected], your user name! That means the connection was successful.

3. Download the code from [email protected]

git clone http://git.oschina.net/xxxxxx/xxxxxx.git here is where you need to clone the GIT project address, OK to here can be normal use

Common git commands

1. Add Files

Git Add Test.txt

Git Add. Loop to add all files within a folder

Git add-u, which uses the-u parameter to invoke the git add command, marks the tracked files that have changed locally (including deletions and modifications) to staging area.

Git add-a, using the-a parameter will add all changed tracked and non-tracked files.

Git add-i, commands to view files that have been modified or deleted in the file but not submitted.

Git add–u adds information about the modified or deleted files in all tracked files to the index library. It does not process untracted files.

Git commit-m "Add Test.txt"

Git Push Origin Master

2. Delete Files

Git RM test.txt

Git commit-m "Delete Test.txt"

Git Push Origin Master

Remove only from the GIT library

Git RM--cache Test.txt

Delete all files under a folder and its folders

Git RM web-r-F

3. Cloning

Git Clone URL

4, deleted the wrong, restore

Git Reset HEAD Test.txt

5. View log of each commit

Git Log

  

The things about Git.

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.