Recent uses Git, a brief introduction on the specific usage right

pull: pull-down code is equivalent to the remote download to your local code with your local code merger
push: push the code is to upload your code to the remote operation of
the complete process is:

The first method is simple and easy to understand :()

1, git add. (Followed by a point, meaning you add all locally modified files to the staging area)
2, the commit -m git "" (quotation marks inside your presentation, this is your submission What is the content, easy to you later, this is the index of the current contents of the user and log message describing the changes stored in the new submission together)
3, git pull Origin Master this is the drop-down code, remote latest code to begin your local codes merging it, if it is determined not updated remotely, you can do this, it is best always do the following, open the code after the completion of view there is no conflict, and resolve, if there is conflict resolution after the completion of the implementation of 1 with 2 again operation
4, git push origin master code can be a push to the remote

 

The second method:

1, git stash (which is the time value of native code rollback to the last submission, is not new to change your code)
2, git pull Origin Master (remote pull down)
3, git stash POP (the first step rollback code released, equivalent to the code to modify your code to pull down the merger)
and resolve conflicts, your local code will be the latest code
4, the Add git.
5, git the commit -m ""
6, git push origin master
this short code is pushed to the remote
and finally git pull origin master to make sure that all remote pulled down, and some you just finished submitting someone has submitted, and then you pull the latest problem will not be avoided ratio

Or reference to the following step

Before submitting the code, the server needs to start pulling the code above, the code to uncover the others.
1: Pull the server code
  git pull
2: View the current working directory tree of work to modify the state
  git status
  states:
    1: untracked: untracked, this file in the folder, but has not added to the git repository, does not participate in version control. by git add state to Staged.
    2: modified: file has been modified, only the modified and no other operations.
    3: deleted: deleted files, delete locally, on the server has not been deleted.
    4: Renamed:

3: the code will be submitted to the buffer status change
  git add + file
  git add -u + path: the modified tracking code is submitted buffer
  git add -A + Path: The modified code is not submitted to the track buffer
  e.g. :
    Git the Add -u vpaas-frontend / src / components
    which has been modified code under vpaas-frontend / src / components directory is submitted to the cache tracked

    git add -A vpaas-frontend / src / components
    which has been modified code under vpaas-frontend / src / components untracked submitted to the directory cache

4: The code is submitted to the local repository
  git commit -m "comment section ref T3070"

  Note:
    T3070: Task No.

5: push server code
  git push

Question
1: mistakenly submitted the code to the cache (cache mistakenly codes submitted using the git add command)
  Solution: use git reset command to withdraw the code cache.

2: Code mistakenly submitted to the local repository (git commit command mistakenly use the code submitted to the local repository)
  Solution:
  git the -soft the RESET + version
  to fall back to a version, only commit rollback information, and will not change the code has been modified.
  git reset -hard + version
  completely roll back to a version of the local code will change on a version of the content.


Original link: https: //blog.csdn.net/nimoyaoww/article/details/78985041

Guess you like

Origin www.cnblogs.com/zmdComeOn/p/12005692.html