在使用git进行团队开发工作中,有些常用命令频繁使用,也有关于git的一些使用技巧。
在这里做一个记录分享给大家。如果有人能从这个文档里得到帮助,我会感到很开心o(* ̄▽ ̄*)ブ。
下面的总结都是本人在实际使用过程中的心得,如果有什么纰漏,请协助我完善这个文档
git tag -a <TagName> <CommitHash>- 查询某个文件的修改记录
git log filePath- 拷贝这个文件需要回退到的commit 记录
git reset commidID filePath- 执行回退操作
git checkout filePathgit log --oneline --graph --decorate git blame FilePathgit whatchangedgit whatchanged Path- 查询某个文件的修改记录
git log FilePath- 拷贝这个文件需要回退到的commit 记录
git reset commidID FilePath- 执行回退操作
git checkout FilePathgit rm --cached FilePathgit rm -r --cached FilePathgit checkout -b BranchNamegit branch BranchName删除本地分支
git branch --delete --force <branchName>或者使用选项-D作为简写
git branch -D <branchName>git push origin --delete <branchName>或者
git push origin :<branchName>git push origin --delete <branchName>git branch -m <oldBranchName> <newBranchName>- 先切换到主分支
git branch master- 获取最新代码
git fetch- 执行合并操作
git merge origin BranchName