新建分支
git branch newbranch
查看分支
git branch
切换分支
git checkout newbranch
查看是否切换到该分支
git branch
提交改动到当前分支
git add.
git commit -a
查看提交状态
git status
切换回主分支
git checkout master
将新分支提交的改动合并到主分支上
git merge newbranch
查看合并后产生的冲突
git diff
再次提交
删除分支
git branch -D newbranch
git add.
git comm -m "提交信息"
代码上传至远程库中
git pull origin master
git push origin master
$ git push origin master
To https://gitee.com/l_jj/bookms.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/l_jj/bookms.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
git pull --rebase origin master
git push -u origin master
和远程仓库建立连接
git remote add origin 远程仓库地址
从远程仓库克隆
git clone 远程仓库地址 本地目录
git仓库初始化
git init
git pull 版本库更新
git add 新增文件加入Git中
git rm 删除
git commit 提交当前工作空间的内容
git push 将本地commit的代码更新到远程版本库中
git log 查看历史日志
git revert 还原某一个版本的修改
git rebase 分支内节点的移动(第一次提交完成时,分支点在a,第二季提交完成时,分支点在b,具有从a->b的能力)
git reset 将当前工作目录完全回滚到制定的版本号