git branch -a 查看远程分支与本地分支(所有分支)
git push origin --delete 分支 删除远程分支(危)
git branch -d 分支 删除本地分支
git remote update origin --prune 更新远程分支列表
git status 查看状态及执行提交命令
git merge 分支 将分支合并到当前分支下
git remote add origin 地址 连接远程仓库
git clone 地址 -b 分支 克隆远程仓库指定分支
git push -u origin 分支 将文件推送到远程仓库
git checkout -b 分支 建立一个新的本地分支
git log 查看commit的日志
git fetch 将远程仓库最新内容拉到本地仓库
git fetch origin 分支:tmp 拉取远程仓库最新内容到分支tmp
git reflog 查看提交版本commit id(用于回退)
git reset --hard commit id 回退至commit id对应的版本
=================== 与远程仓库数据合并=========================
$ git pull origin dev
$ git branch -a
$ git checkout -b dev
$ git add .
$ git commit -m "修改数据"
$ git checkout dev
$ git merge dev --allow-unrelated-histories
$ git add -A
$ git commit -m "xxx"
$ git push -u origin dev
===============报错==============
! [rejected] dev -> dev (non-fast-forward)
error: failed to push some refs to 'github.com:gzh52103/Brave-niu-niu-is-not-afraid-of-difficulties.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
解决方法
git pull --rebase origin dev(造成冲突)
git add -A
git commit -m "xxx"
git rebase --continue
git push -u origin dev
|