• git fetch <remote-host-name> <remote-branch-name> Update remote code to local repository, no automatic merge, later you can compare the difference between local and online branches
  • git merge <remote-host-name>/<remote-branch-name> Merge the remote code into the local repository
  • ``git pull :` pulls the remote branch updates to the local repository and automatically merges
    #git pull = git fetch + git merge
    #It is not recommended to use git pull directly, instead the following command is recommended
    git fetch origin master
    #compare changes, then merge
    git diff HEAD FETCH_HEAD
    git merge origin/master
    
  • git pull <remote-host-name> --tags pull remote tags
  • git remote -v show all remote repositories
  • git remote show <remote-host-name> <remote-branch-name> Show information about a remote repository
  • git remote add <remote-host-name> <git-url> Add a new remote repository and name it
  • git push <remote-host-name> <remote-branch-name> Push the local branch to a remote branch that it tracks (usually both have the same name), or create a new remote branch if it doesn’t exist
  • git push <remote-host-name> : refs/for/<remote-branch-name> Delete the specified remote branch1
  • git push <remote-host-name> --delete <remote-branch-name> Delete the specified remote branch 2
  • git push <remote-host-name> If the current branch has a tracking relationship with the remote branch, both the local and remote branches can be omitted and the current branch pushed to the corresponding branch on the origin host
  • git push If the current branch has only one remote branch, then both host names can be omitted
  • git push -u <remote-host-name> <remote-branch-name> If the current branch has a tracking relationship with multiple hosts, you can specify a default host with the -u argument, so that you can use git push without any arguments later
  • git push --all <remote-host-name> pushes all local branches to the remote host, regardless of whether there is a corresponding remote branch
  • git push --force <remote-host-name> force the push to the remote host
  • git push <remote-host-name> --tags Push tags