git 命令行基本操作
来源:互联网 发布:ios良心网游 知乎 编辑:程序博客网 时间:2024/06/05 03:07
学习网站 http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000
git命令中最基本使用的
1、从远程仓库克隆项目
git clone 远程仓库地址
git clone https://git.oschina.net/huanghehg/testgit.git
Cloning into 'testgit'...
Username for 'https://git.oschina.net':用户名
Password for 'https://huanghehg@git.oschina.net':密码(此处不会显示)
remote: Counting objects: 23, done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 23 (delta 7), reused 0 (delta 0)
Unpacking objects: 100% (23/23), done.
Checking connectivity... done.
2、查看本地文件状态
git status
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:(会提示该怎么做)
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: git.txt
no changes added to commit (use "git add" and/or "git commit -a")
3、将修改内容提交至暂存区
git add 修改文件
$ git add git.txt
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: git.txt
4、将暂存区内容提交本地版本库
git commit -m '填写备注'
$ git commit -m 'testgit'
[master 6be6977] testgit
1 file changed, 2 insertions(+), 1 deletion(-)
5、因为大部分情况是多人协作开发,所以在把本地版本库推送至远程仓库之前需要拉取最新代码
git pull origin 分支名称
From https://git.oschina.net/huanghehg/testgit
* branch master -> FETCH_HEAD
Already up-to-date.
6、如果发生冲突解决冲突之后走这步
git push origin 分支名称
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 253 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To https://git.oschina.net/huanghehg/testgit.git
31af53a..6be6977 master -> master
7、开辟分支
git checkout -b 分支名字
开辟新分支 并跳转到新分支
8、切换分支
git checkout 分支名字
9、查看本地分支列表
git branch
$ git branch
master
* testbranch1(*代表当前分支)
10、合并分支
git merge 分支名字
11、查看log
git log
12、版本回滚
git reset --hard 版本号
http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/0013744142037508cf42e51debf49668810645e02887691000
- Git基本命令行操作
- git 命令行基本操作
- Git命令行基本操作
- git 命令行指令基本操作
- git 的基本命令行操作
- 命令行托管git项目基本操作
- Git 分布式版本控制系统 基本命令行操作
- git命令行基本用法
- git基本命令行
- Git 命令行操作
- git命令行操作
- Git命令行操作
- # git命令行操作:
- Git 命令行操作
- git命令行常用操作
- 【Git】Git命令行操作简写
- svn 命令行基本操作
- BASH命令行基本操作
- 使用maven结合ssh开发出现的错误
- PHP导出数据到Excel文件
- recylerview添加viewpager作为头
- NC开发笔记——1、主子表增加页签
- java无锁
- git 命令行基本操作
- 更改linux 防火墙
- Oracle闪回查询恢复delete删除数据
- 限制字符串长度的函数
- 原Servlet生命周期与工作原理
- 源码分析——HashMap和HashTable区别
- Python的语法的基本的总结
- C++项目管理
- Windows Dev Intro - How to avoid TVN_SELCHANGED not captured