Git pulls remote branches to local
Create a blank folder locally folder
;
Enter the folder
directory, open it git bash
, and initialize the git repository with the command line;
$ git init
Establish connection with remote warehouse;
// `http://xxx...`该网址为远程仓库`Game`的ip地址,可在远程仓库`Game`中进行查看
$ git remote add origin http://192.168.22.88:8000/102840/Game.git
Pull the remote branch to the local;
// `cs`替换为远程分支名
$ git fetch origin cs
Create a branch locally cs
and switch to that branch;
// `cs`替换为本地分支名(若不存在则自动你创建),`origin/cs`替换为远程分支名,
$ git checkout -b cs origin/cs
Pull the content of a remote branch to the local;
// `develop`为远程分支名,可为任意已存在的分支
$ git pull origin develop
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
Add the modified file to the git cache;
$ git add -A
Submit changes;
$ git commit
Push to git.
$ git push
git status
Commands 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.