git常用操作

创建仓库

git clone http://*.git

git init

git remote add origin https://*.git //添加远程仓库

git pull origin master --allow-unrelated-histories //与远程仓库关联

修改配置

编辑.git/config文件

[user]
        name = 七月编程
        email = 七月编程@126.com
[remote "origin"]
        url = https://github.com/july/july.git

git config user.name 潮哥笔记

新增文件并提交至远程仓库

git add .

git commit -m ‘’

git push

创建分支

git branch 分支名称

git checkout 分支名称  //切换分支

git checkout -b 分支名称

git branch -a //查看所有分支

合并分支

git merge 分支名称  //合并分支到当前分支

文件暂存/恢复

git commit提交文件,服务器返回本地文件有修改。

1、git stash :暂存本地代码

2、git pull origin develop : 获取远程分支代码

3、git stash pop:恢复之前暂存的文件

tag标记

git tag -a v1.1 -m ‘嗯’

git push --tags //推送tag到远程仓库

回退版本

1、找到你误提交之前的版本号

2、git revert -n 版本号

3、git commit -m xxxx 提交

4、git push 推送到远程

参考:https://www.cnblogs.com/aligege/p/10221174.html

常用命令

https://blog.youkuaiyun.com/hualusiyu/article/details/78319126?utm_source=app&app_version=4.5.2

常用操作

https://mp.weixin.qq.com/s/fr_1JseO3_FjVz40H0kIEA

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值