git常用命令
来源:互联网 发布:干支纪年法简便算法 编辑:程序博客网 时间:2024/05/23 10:44
创建 repo: git init
添加修改到暂存区: git add <file>
提交暂存区修改到当前分支:
git commit -m “<log message>"
查看当前状态(分支指向,change信息):
git status
比较工作区文件与最新版本差别: git diff HEAD — <file>
显示已提交的所有文件列表:
git show --pretty="format:" --name-only <version num>
丢弃工作区修改(即恢复到最近一次add 或 commit 时的状态): git checkout — <file>
将文件从暂存区撤回: git reset <file> (git rm -r --cached <file>)
版本恢复或回退: git reset —hard HEAD^ , git reset —hard <version num>
提交日志: git log —pretty=oneline
命令日志: git reflog
关联当前 repo 到远端仓库: git remote add <remote> <address>
修改远端的地址: git remote set-url origin git@github.com:XXXXX/YYYYY.git
将最新commit 推送到远端分支:
git push <remote> <branch>
从远端分支拉取最新commit 并合并到当期分支: git pull <remote><branch>
从远端仓库克隆:
repo: git clone <address>
创建分支: git branch <branch>
在远端创建分支(即在本地创建好分支后推送到远端): git push -u <remote> <branch>
查看分支: git branch
删除分支: git branch -d <branch>
创建并切换到分支: git checkout -b <brach>
从远端克隆分支并切换到该分支: git checkout -b <remote>/<branch>
切换到分支: git checkout <branch>
合并分支到当前分支: git merge <branch>
- git 常用命令
- Git常用命令
- git 常用命令
- git 常用命令
- git 常用命令
- git 常用命令
- GIT常用命令
- git 常用命令
- git 常用命令
- Git 常用命令
- git 常用命令
- Git常用命令
- Git常用命令
- git 常用命令
- Git 常用命令
- git常用命令
- git 常用命令
- Git 常用命令
- PAT算法笔记(八)————有几个PAT*
- Windows 安装 Python2.7.9全解,包含错误:2503
- 凹凸多边形的拆分
- 修 改自己的电 脑动 态I.P
- sscanf函数
- git常用命令
- leetcode_3_Longest_Substring_Without_Repeating_Characters
- 网站可靠性工程 SRE
- tensorflow实现CNN
- 构建根文件系统之瑞士军刀BusyBox
- 深入理解C++中public、protected及private用法
- HTTP请求报文和HTTP响应报文
- 使用Python3获取360影视首页上电影的名称,年份,评价,播放链接并保存为txt文本
- AndroidAOP之路二 注解处理解释器