Summary of Git's commonly used commands

1. Download and install git in advance;

2. To create a user name, the command is as follows:

git config --global user.name "自己的用户名"

3. To create a user mailbox, the command is as follows:

git config --global user.email "一个邮箱地址"

4. Initialize a branch directory (cd to the directory you want to create), the command is as follows:

git init

5. In the current directory, connect to the remote server, the command is as follows:

git remote add origin ssh://[email protected]:29418/kqgisportalserver.git

6. To view the status of the local git library, the command is as follows:

git status

7. To add files to the local git repository, the command is as follows:

git add 文件名称

If you want to add all files, the command is as follows:

git add .

8. Upload the files in the local git library to the remote git server, the command is as follows:

git push -f origin dev

9. View your own remote git server configuration, the command is as follows:

git remote -v

10. To create a new branch, the command is as follows:

git branch test

10. Switch to a branch, the command is as follows:

git checkout test

11. To create a remote warehouse, the command is as follows:

创建远程分支 git   push  origin  test:test

12. Associate the local branch with the remote server branch, the command is as follows:

git branch --set-upstream-to=origin.test

13. Pull the code under the test branch, the command is as follows:

git pull

 

Guess you like

Origin blog.csdn.net/joyksk/article/details/114015262