git常用命令

常用命令

#设置
git config --global user.name="user"
git config --global user.email="user@email.com"

#与服务器交互
#从服务器克隆
git clone https://github.com/e--/prj.git
git remote add origin https://github.com/e--/pri.git
git clone origin
git remote set-url origin https://github.com/e--/pri.git
#从服务器下载
git fetch origin
git merge origin/master
git pull
#上传到服务器
git push origin master

#本地
git status #查看状态
git log #查看提交历史
git add #添加
git add .
git comment #提交
git comment -m "first commit"
git comment -a -m "second commit"
git checkout -b xxx #建立branch xxx,并切换到xxx,等于git branch xxx; checkout xxx;
git branch -d xxx#删除branch xxx
git branch --merged
git branch --no-merged
git stash #暂存
git stash list
git stash apply #使用暂存
git stash drop
git commit -amend
git filter-branch
原文地址:https://www.cnblogs.com/zhizhou/p/3639483.html