Git manage folders

Window in concise use Git

1. From the command line, type git, the following tips have proven successful installation, there is git tools.

2. If there are already tools git, git init initialization input directory to be backed up in the library, the current directory is already a git repository.

3.git status command displays the current status, general default in the master branch directly.

4.git add files waiting to be submitted will be using git rm --cached cancel cache, there would not wait for the file to be submitted.

5.git "submit information" commit -m to submit your data in the cache to the repository

6. At this time git status will be prompted to re-enter the record nothing to commit, git log displays input submitted

II. Code submitted to synchronize github

Check your computer to install ssh, ssh is a network protocol used to encrypt login between computers, is now standard on every linux computer, most of git server for authorization by ssh public key, so I want to make github commit code the first step is to add the SSH key configuration

  1. Generating SSH key input ssh-keygen -t rsa rsa algorithm to generate the specified key, followed by the Enter key three, and two files id_rsa id_rsa.pub, took must copy the contents of id_rsa.pub to github after, successful authorization to commit code
  2. Github added ssh-keys, submission process will be omitted.
  3. Push / pull submit code

.Git clone to clone a project to a local
this time the project itself is already a git repository, and git init does not need to be initialized, and has been associated with good remote repository, then only need to modify or add any files in the directory, then commit, then you can execute git push origin master update: this is the easiest way to
two local association existing projects.

  1. Build a project on github

  2. The local project associated with github repository, switched local project directory, execute the following command git remote add origin git @ github.com: account name / warehouse name .git
    ** command interpreter: ** add add a remote repository, git repository address @ github.com: account name / warehouse name .git, origin is to the remote warehouse project from the name, the name can easily take, a well-recognized name is only a remote repository origin. Can establish multiple remote warehouse, a company, github one so can be submitted to different remote repository, you can specify a different name.

  3. View the current remote repository: git remote -v
    Next, the local repository can be submitted code to a remote repository
    git push origin master
    will submit code to a remote repository

Tips: In the config file in the .git directory, add name, and email information before submitting code to be set from the user name and mailbox, the following information will appear in the code each time commit information can be set :

git config –global user.name”stormzhang”
git config –global user.email “.com”
Published 12 original articles · won praise 0 · Views 435

Guess you like

Origin blog.csdn.net/qq_36523203/article/details/103302243