Skip to content

Instantly share code, notes, and snippets.

@xiaoysh8
Last active November 23, 2018 09:13
Show Gist options
  • Save xiaoysh8/559cdab860291b437d3c4f295f6ce520 to your computer and use it in GitHub Desktop.
Save xiaoysh8/559cdab860291b437d3c4f295f6ce520 to your computer and use it in GitHub Desktop.
git
/** git 配置 */
git config --global user.name "edward"
git config --global http.sslVerify false
/** git 下载远程仓库分枝 */
git remote add origin https://github.com/user/repo.git
git fetch origin
git checkout branch
/** 修改远程仓库 */
git remote set-url origin https://github.com/USERNAME/REPOSITORY_2.git
/** 提交远程资料 */
git push -u origin master
//回到从前
//增补提交
//不同commit之间往返
git log --online //simple display
--graph
git commit --amend --no-edit
git status -s //simple display
git reset file //stage to unstage or modified
git reset --hard HEAD //restore to lateset commit,clear everthing been modified or added.
git status -s //diplay nothing
//turn to previous version
git reset --hard HEAD^^
git reset --hard HEAD~2
git reset --hard HEAD~100
git reset --hard 1673dfed
//jump to different version for single file
git checkout 1d7a143 -- file
git checkout 2dbe34d
git checkout master //return
//checkout every step
git reflog
//create branch
git checkout -b dev
git branch dev
// delete branch
git branch -d dev
//switch branch
git checkout master
//conflict
//merge
//current branch master
git merge --no-ff -m 'keep merge info' dev
--no-ff no fast forward
//rebase
git rebase dev
git rebase --continue
//stash
git stash
git stash pop
//add remote
git remote add origin https...
git push -u origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment