Git 操作步骤

1、先在github上新建一个project

2、create repositories

3、配置git基本信息

4、cd到一个新的file,初始化git信息

 5、将git上新建的项目clone至当前目录

  git clone https://github.com/hoboloser/tool.git

6、将需要上传的信息copy进来

7、git添加新文件和文件夹 并提交

  git add . 添加所有

8、如果是新项目一定要记得使用下面这个命令,进行本地项目和远程项目的关联,

9、上传  git push -u origin master

 ps:错误的时候:

请使用:git pull --rebase origin master

----  更新

git status   查看当前git状态

查看分支:git branch

创建分支:git branch <name>

切换分支:git checkout <name>

创建+切换分支:git checkout -b <name>

合并某分支到当前分支:git merge <name>

删除分支:git branch -d <name>

查看git提交日志:git log

推送分支:git push origin dev_branch

回退:git reset --hrad id

查看当前用户: git config user.name

查看当前用户邮箱: git config user.email

pull指定分支:

git pull origin online:online  取回远程库中的online分支,与本地的online分支进行merge
git pull origin online 如果是要与本地当前分支merge,则冒号后面的<本地分支名>可以不写
原文地址:https://www.cnblogs.com/binbang/p/6647343.html