Git 使用记录

Git 用户配置

1.set user.email and name

git config --global user.email "your email"
git config --global user.name "your name"

2.create SSH

ssh-keygen -t rsa -C "your email"

3.save local key to github setting
copy key in ~/.ssh/id_rsa.pub to github setting SSH keys

4.store your account and psw

git config --global credential.helper store
git pull

保留账户和密码

# run
git config --global credential.helper store
# and then
git pull
# and then 
# input your name and pwd

Git 设置代理

git config --global http.proxy 127.0.0.1:****
git config --global https.proxy 127.0.0.1:****

and then
git config --list 
to show your config

Git初始化本地已有项目

1.初始化仓库

git init

2.remote

git remote add origin <仓库地址>

3.从远程分支拉取master分支并与本地master分支合并

git pull origin master:master

4.提交本地分支到远程分支

git push -u origin master

5.将现有项目添加并提交上传

git add -A
git commit -m 'something'
git push --set-upstream origin master

其他

1.撤销commit

git reset --soft HEAD~n  # 倒数第n个

2.撤销已添加的文件

git rm --cache path_to_file

3.update gitignore

git rm -r --cached . && git add . && git commit -am "Remove ignored files"

4.track remote branch

# create a new local branch to track remote branch
git checkout --track origin/dist

git branch -u origin/release release

5.tracking info

git branch -vv   # doubly verbose!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值