入门专题-git

来源:互联网 发布:过滤器相关java面试题 编辑:程序博客网 时间:2024/06/02 05:50

使命

版本管理

安装

网上由很对教程,不进行赘述

命令

基本命令

git clone url 克隆项目
git add 关联文件到git
git commit 提交
git push 推送
git pull 更新
git status 查看状态

冲突解决

git pull
解决冲突
git commit
git push

回退到过去某一版本

#hashid是提交编号

git loggit reset --hard #hashidgit reflog

合并

合并某分支到当前分支

git merge name

更新

git fetch 更新不合并,比pull更安全

git fetch origin mastergit log -p master..origin/mastergit merge origin/master

相当于

git fetch origin master:tmpgit diff tmp git merge tmp

git pull 更新并合并

git pull origin master

创建分支

创建分只并切换

git checkout -b develop

相当于

git branch developgit checkout develop

列出所有分支

git branch

里程碑/标签

描述信息message
名称name
提交idhashid

git tag -m  #message #name [#hashid]

暂存

暂存,查询暂存列表,回复缓存,缓存清理

git stashgit stash listgit stash applygit stash clear
原创粉丝点击