Git pulls the remote branch to the local, modify and synchronize

Git pulls remote branches to local

  1. Create a blank folder locally folder;
  2. Enter the folderdirectory, open it git bash, and initialize the git repository with the command line;
$ git init

Initialize local git repository using Git bash command line

  1. Establish connection with remote warehouse;
// `http://xxx...`该网址为远程仓库`Game`的ip地址,可在远程仓库`Game`中进行查看
$ git remote add origin http://192.168.22.88:8000/102840/Game.git
  1. Pull the remote branch to the local;
// `cs`替换为远程分支名
$ git fetch origin cs	
  1. Create a branch locally csand switch to that branch;
// `cs`替换为本地分支名(若不存在则自动你创建),`origin/cs`替换为远程分支名,
$ git checkout -b cs origin/cs	
  1. Pull the content of a remote branch to the local;
// `develop`为远程分支名,可为任意已存在的分支
$ git pull origin develop
  1. Push the content on a local branch to the remote branch.
// `cs:cs`中,第一个`cs`为本地分支名,第二个`cs`为远程分支名,
// 若当前分支为`cs`,则可略去第一个`cs`
$ git push origin cs:cs

Submit after local code modification

  1. Add the modified file to the git cache;
$ git add -A
  1. Submit changes;
$ git commit
  1. Push to git.
$ git push

git statusCommands can be used to view the status of the current git repository. If there are uncommitted changes, these changed files will be displayed in red font.

Guess you like

Origin blog.csdn.net/gkzscs/article/details/108317907