Git工作流及常用命令

Git安装

直接官网下载git for windows

用户信息配置

git config --global user.name "John Doe"
git config --global user.email johndoe@example.com

git config --list

Git基本命令

work flow

git clone
git checkout -b branch_name origin/develop
    coding...
    coding...
git commit -a -m "wa"
git push origin branch_name
    merger request...
    compare
git pull
    auto merge...
    or by hand
git push

其他命令

git branch -r  # 远程分支
git branch -a  # 所有分支
git branch -d / -D  # 删除

git pull = git fetch + merge to local

git diff # 尚未保存的与暂存区的diff
git diff --staged  # 已经暂存的将要添加到下次提交的内容

git log --graph
git log --pretty=format:"%h - %an, %ar : %s"

# 例如,你提交后发现忘记了暂存某些需要的修改,可以像下面这样操作:

git commit -m 'initial commit'
git add forgotten_file
git commit --amend
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容