git 命令

2019/08/20

列出详细的远程仓库

git remote -v

clone远程仓库

git clone https://git.xxx

添加远程仓库

git remote add name https://git.xxx

将远程主机的最新内容拉到本地

git fetch name

删除本地指定的远程地址

git remote remove origin

创建分支

git checkout -b test origin/dev-190815

提交当前分支到远程仓库

git push hongpo test

添加提交

git commit -a -m “修改”

推送

git push hongpo w-dev-190815

删除本地分支:

git branch -d dev20181018

如果删除不了可以强制删除

git branch -D dev20181018

删除远程分支:

git push origin –delete dev20181018

git重命名本地分支 并提交到远程

1·重命名分支

git branch -m oldBranchName newBranchName

2 删除远程分支

git push origin :oldBranchName

3 将重命名的分支提交

git push origin newBranchName

提交代码 撤销操作

git revert HEAD

替换上一次提交

git commit –amend -m “fixes bug #42”