Git命令:常用Git命令集合

1.Git基本工作流程

 2.命令

命令作用
git init初始化,创建 git 仓库
git status查看 git 状态 (文件是否进行了添加、提交操作)
git add 文件名添加,将指定文件添加到暂存区
git commit -m '提交信息'提交,将暂存区文件提交到历史仓库
git log查看日志( git 提交的历史日志)

历史版本切换:

git reflog
git reset --hard 版本唯一索引值

 

分支管理操作:

- 创建和切换
  创建命令:git branch 分支名
切换命令:git checkout 分支名
- 新分支添加文件
  查看文件命令:ls
  总结:不同分支之间的关系是平行的关系,不会相互影响
- 合并分支
  合并命令:git merge 分支名
- 删除分支
  删除命令:git branch -d 分支名
- 查看分支列表
  查看命令:git branch

远程仓库工作流程(理解)

 

杨路恒@WIN-S5E6V36PP3P MINGW64 /d/Java
$ git add 张颖
fatal: not a git repository (or any of the parent directories): .git

杨路恒@WIN-S5E6V36PP3P MINGW64 /d/Java
$ git init
Initialized empty Git repository in D:/Java/.git/

杨路恒@WIN-S5E6V36PP3P MINGW64 /d/Java (master)
$ git add 张颖
warning: adding embedded git repository: 张颖
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint:   git submodule add <url> 张颖
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint:   git rm --cached 张颖
hint:
hint: See "git help submodule" for more information.

杨路恒@WIN-S5E6V36PP3P MINGW64 /d/Java (master)
$ git commit -m '张颖'
[master d755aaf] 张颖
 1 file changed, 1 insertion(+)
 create mode 160000 "\345\274\240\351\242\226"

杨路恒@WIN-S5E6V36PP3P MINGW64 /d/Java (master)
$ git push -u origin master
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 312 bytes | 312.00 KiB/s, done.
Total 2 (delta 0), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-6.0]
To gitee.com:lhyoungxy/zhangying.git
   73067e1..d755aaf  master -> master

从远程仓库复制到本地仓库:

git clone  git@gitee.com:lhyoungxy/zhangying.git

git pull   git@gitee.com:lhyoungxy/zhangying.git

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lhyangtop

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值