git manual

git manual

我的github pages 地址:https://alexanderwangsgithub.github.io/blog/Git_Manual.html

Repository

远程到本地

git clone git@git.elenet.me:napos.vine/vine.git

clone的时候rename

git clone git@github.com:AlexanderWangsgithub/AlexanderWangsgithub.github.io.git yours.github.io

本地提远程

git init
git add .
git commit -m "init"
git remote add origin  git@github.com:AlexanderWangsgithub/AlexanderWangsgithub.github.io.git
git push -u origin master

Branch

get branch info:git branch

create branch:git branch branchName

switch branch:git checkout branchName

create and switch branch:git checkout -b branchName

merge to current branch:git merge branchName

delete branch:git branch -d branchName

update branch: git fetch

add but not commit:

git reset HEAD ~/*/MarketManagerScoreServiceImpl.java
git checkout -- ~/*/MarketManagerScoreServiceImpl.java 

merge conflict

git reset --hard
git pull --rebase
git rebase --skip
git pull

Rollback

not pushed

git reset [--soft | --mixed | --hard

pushed

git revert c011eb3c20ba6fb38cc94fe5a8dda366a3990c61

compare

reset 是删除历史版本,HEAD向后移动的;revert是反向提交,HEAD是向前移动。

同步Fork项目作者更新

git remote add fork_father https://github.com/fatherProject
git pull fork_father master

即除了origin,再添加一个来源。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值