Linux under GIT upload and download

-------------------------------
code upload formal process
--------------- ----------------
1, establishing a local warehouse

git init

This directive local source directory on execution, the execution is successful, as ".git" directory in the current directory generate a hidden name. All operational information for the local repository are stored in this directory.

2. Add all files in the project to a local warehouse

git add .

. "" Indicate here the current directory, if you add only certain directories, use: git add [directory 1] [Table of Contents 2]

3, before submitting the project description

git commit -m "注释语句"

4, the local repository is associated to a corresponding GitHub (cloud code) repository, https link later changed to the address corresponding to the .git GitHub (cloud code) repository

git remote add origin https://github.com/abc/abc.git

5, before uploading github pull it

git pull origin master

Use master here is because master branch of a remote repository, if you want to upload to other branches, where instead specify the branch name.

6, upload the code to GitHub (cloud code) of the remote repository

git push -u origin master

If you have not saved will be prompted github (code cloud) login account and password, and then execute this command input Username and Password, the code previously submitted will be uploaded after entering the correct github (code cloud) login account and password.

-------------------------
upload the code to quickly process
--------------------- ----
1. Check local code and local code repository difference

  $ git status

2, to confirm the update and correct all changes to the local repository

$ git add *

3, commit your changes

$ git commit -m "说明信息"

4, access to a remote warehouse specified branch of the latest code

$ git pull origin master

5, uploaded to a remote warehouse specified on branch

 $ git push origin master

--------------------------
Download the code formal process
-------------------- ------

1, view the local branch of the file information, to ensure that no conflict of updates
git status

2, if the file has changes, you can revert to the original state; if files need to be updated to the server, you should merge to the server, and then update to the local
git checkout – [file name]

3, view the current bifurcation
git branch

4, if the branch for the local branch, you need to switch to a remote branch server
git checkout remote branch
5, if the command is successful, the update code is successful!
git pull

-------------------------
Download the code for fast-track
--------------------- ----

1, the above approach is relatively safe, if you can determine what did not turn over just update the local code
a command to get

git pull

2, if there is wrong to use the following statement to slowly adjust
git branch to see the branch
git chechout aaaand branch switching aaa
git branck aaacreate aaa branch
git chechout -b aaalocal branch created aaa, aaa while switching to the branch. Only when submitted will create a branch on the server

Guess you like

Origin blog.csdn.net/zlk4524718/article/details/92796217