git使用心得

总结下最常使用的git命令,废话少说,直接上干货。

1)git初始化

这个新手一般很少遇见,但是如果要使用类似github这样的git仓库,第一个肯定是如何创建git的问题。

在github上先创建自己的仓库源,然后做以下操作

1> git账户的录入
   git config --global user.name "Your Name"
   git config --global user.email you@example.com
   全局的通过vim ~/.gitconfig来查看

   git config user.name "Your Name"
   git config user.email you@example.com
   局部的通过当前路径下的 .git/config文件来查看

   也可以修改提交的用户名和Email:
   git commit --amend --author='Your Name <you@example.com>'

2> git init (初始化本地git)
3> git remote add origin git@github.com:*/*.git
4> git add -A
5> git commit -a -m 'blablabla'
6> git push -u origin master -f

2)查看git已设配置

git config --list


3)git clone项目

git clone <span style="font-family: Arial, Helvetica, sans-serif;">git@github.com:*/*.git</span>

4)git推送代码

1> git add xxx(git add -A是准备add所有代码)
2> git commit -a -m 'xxx' 
3> git push(如果失败需查看是否有冲突)

5)git分支

git branch


6)忽略本地代码

git stash




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值