Complete collection of Git commands

1. Clone the code

View project address

git remote -v

direct clone

git clone url

Clone specified branch

git clone -b 分支 git地址

RPC failed error: modify Git’s transfer byte limit

git config --global http.postBuffer  1048576000

2. View branches

Check

git branch -a

switch branch

git branch 分支名

Clone from specified branch

git branch -b 分支名 项目地址

3. Upload the local code to the git repository

1. Create a project testgit on Code Cloud (name it according to your needs)

2. Create a folder D:/testgit locally, and then use git bash

3. Right-click in the testgit directory and select Git Bash Here

4. Use the git init command to initialize a git local warehouse (project), and a .git folder will be created locally

5. Usegit remote add origin the https address of the project //Add a remote warehouse

6. Use the git pull origin master command to pull the warehouse on the code cloud to a local folder

7. Use git add . or git add + 文件名 (save the file to the cache)

8. Usegit commit -m '描述新添加的文件内容' (that is, comments) (save the file to the local warehouse)

9. Usegit push origin master to push the local warehouse to the remote warehouse

Reprinted from: https://www.cnblogs.com/guaguaerhao/p/7865034.html

4. Modify the remote address

After the remote warehouse address is modified, how to modify the git remote warehouse address is as follows:

method 1

Update new address directly

git remote set-url origin URL   // 更换远程仓库地址,URL为新地址
Method 2

Delete the existing address first, then add a new one

git remote rm origin  // 删除现有远程仓库
git remote add origin url   // 添加新远程仓库

5. Clear information

Delete a locally created repository

find . -name ".git" | xargs rm -Rf

git clear account information

git config --system --unset credential.helper

Guess you like

Origin blog.csdn.net/xiaopihair123/article/details/133853611