git

本文详细介绍Git的基本使用流程及常见命令,包括配置个人信息、初始化仓库、添加文件、提交更改等操作,并涉及如何创建与切换分支、合并分支等内容。

linux安装通过命令或者下载包后解压再./configmakesudo make install就可以了

windows 则直接下安装包 选择默认选项即可

$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"
设置你的用户名和email

在创建好自己本地后

git init 初始化

git add 文件名  提交代码到暂存区 git add . 当前整个目录

 git commit 提交到git仓库 需要添加修改理由

git commit -m "直接写修改理由" 

git status 查看代码状态信息

git checkout 在代码没有提交时 把代码从暂存区 回滚到工作区

git log 查看提交日志 git log --pretty=oneline

git reset --hard HEAD^ 向上回滚一个版本   ^^2个  ~100 100个版本

git reset --hard MD5号 回到指定版本

git reflog 查看所有日志 

 rm 《file》 本地删除文件  git add/rm 《file》 提交到暂存区

git reset HEAD 《file》 从暂存区回滚到工作区

git checkout  -- file 把工作区里操作撤销

 

…or create a new repository on the command line

 
echo "# django_form" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:hyn3118166/django_form.git
git push -u origin master

…or push an existing repository from the command line

 
git remote add origin git@github.com:hyn3118166/django_form.git
git push -u origin master

 

git clone HTTP 以HTTP的方式克隆代码

 

查看分支:git branch

创建分支:git branch <name>

切换分支:git checkout <name>

创建+切换分支:git checkout -b <name>

合并某分支到当前分支:git merge <name>

删除分支:git branch -d <name>

转载于:https://www.cnblogs.com/hyn934/p/9102786.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值