1、生成 ssh-key
git config --global user.name "test"
git config --global user.email "test@zang.com"
ssh-keygen -t rsa -C "test@zang.com"
查看.ssh/id_rsa.pub文件
2、git 命令
git add 添加到本地仓库 git add .添加所有 git add '../../Add/TEst' 添加某一变更
git rebase -i
git rebase --continue
git rebase --abort 回退到rebase之前的状态
git rebase --edit-todo
合并到前一个分支 将pick改成s
git checkout //切换仓库
git checkout commitId
git checkout . //还原所有
git checkout -b branchname origin/branchname
git branch //查看当前分支
git branch -r//查看远程分支
git branch -d
git branch -av 查看所有分支列表
git branch localBranch remotes/origin/localBranch
git commit -m //对提交信息标注信息
git commit --amend 修补commit
git commit -m --no-verify
git tag
git push
git push -f 强制推送
git push --set-upstream origin release_1029//本地需要有同名仓库 远程仓库名
git push origin
git push origin HEAD:branchname
强推到远程:git push origin HEAD --force
git status 查看状态
git pull 下拉
git clone 克隆
git reset --hard commitID 删除远程分支
git push origin --delete dev 删除本地分支
git branch -d dev
git push origin :branchname git checkout 切换分支,还原更改
git merge dev 切换到源分支,合并目标分支
git stash 保存 回退命令:
git reset --hard HEAD^;回退到上个版本
git reset --hard HEAD~3;回退到前3次提交之前, 以此类推,;回退到n次提交之前
git reset --hard commit_id;退到/进到 指定commit的sha码
git checkout commit ID;
查看提交记录:git log;
3、Git配置默认忽略了大小写,需要配置为不忽略大小写
查看是否忽略大小写:
git config core.ignorecase 备注:true为忽略了大小写,false为为忽略大小写
设置默认不忽略大小写: git config core.ignorecase false