What are the common commands for Git?

Reference: List of commonly used Git commands
Insert picture description here

1. Common nouns

  • Workspace: Workspace
  • Index/Stage: Staging area
  • Repository: Warehouse area (or local warehouse)
  • Remote: remote warehouse

2. New code base

$ git init  //  在当前目录新建一个Git代码库

3. Configuration

$ git config

4. Add and delete files

$ git add  // 添加当前目录的所有文件到暂存区

5. Code submission

$ git commit  // 提交暂存区的文件到仓库区

6, branch

$ git branch   //  列出所有本地分支

7. Remote synchronization

$ git fetch [remote]  // 下载远程仓库的所有变动
$ git remote  // 显示所有远程仓库
$ git pull [remote] [branch]   // 取回远程仓库的变化,并与本地分支合并
$ git push [remote] [branch]  // 上传本地指定分支到远程仓库
$ git push [remote] --force   // 强行推送当前分支到远程仓库,即使有冲突

8. Withdraw

$ git checkout //   恢复暂存区的所有文件到工作区

Guess you like

Origin blog.csdn.net/weixin_43912756/article/details/108438481
Recommended