learn git

注意空格!
注意空格!!
注意空格!!!

git config --global user.name “”
git config --global user.email “”

mkdir learngit
cd learngit
pwd 查看当前目录

git init

git add
git commit -m""

git status 查看状态
git diff 查看不同
git log 查看提交历史,加入–pretty=online简化参数
git reflog 查看命令历史
git log --graph --pretty=oneline --abbrev-commit

git rm 删除

git clone 远程仓库地址本地从无到有
git pull git fetch+git merge

git remote -v 查看远程库
git remote add origin
git push origin brach-name
git checkout -b branch-name origin/branch-name 在本地创建和远程分支对应的分支
git branch --set-upstream branch-name origin/branch-name 建立本地分支和远程分支的关联

git branch 查看分支
git checkout -b abc *创建并切换,git branch abc ,git checkout abc *
git checkout abc 切换分支
git merge abc合并分支到当前分支
git branch -d abc 删除分支

git stash 储存工作现场
git stash pop 恢复工作现场并删除stash,git stash apply,git stash drop
git stash list

git tag -a tagname -m “” commit id(默认最新commit)
git show tagname
git tag 查看所有标签
git tag -d tagname 删除标签

猜你喜欢

转载自blog.csdn.net/irontonystark/article/details/82933012