Git upload files to a remote server

1. Right-click on the first item, choose Git Base Here
 
2. git init // initialize warehouse

 

3. git add. (File name) // add files to a local warehouse

 

4. git commit -m "first commit" // add file description information

 

5. git remote add origin + remote warehouse address // link remote repository, create the main branch

 

6. git pull origin master // change the local repository connected to a remote repository main branch
 

7. git push -u origin master // push the local repository of files to a remote warehouse

 
The following is the sixth step to expand
(1) first git fetch something to you and then merge the local and then push

$ git fetch origin master

$ git merge origin FETCH_HEAD 

First grab a remote repository update to the local, and then merged with your local repository (if there is a conflict we must resolve the conflict before merging, conflict is more complicated, not explained in detail here), so you can make a remote repository and your local warehouse in agreement, then you can submit modified.

 

(2) This command is equivalent to two
$ git pull origin master

But using git fetch + git merge more secure.

 

(3)git pull --rebase origin master

Rebasing, may be more unified history, history tends to even submit a straight line.

Guess you like

Origin www.cnblogs.com/shoose17/p/11375455.html