$ git add forgotten_file
$ git checkout branch1
$ git commit –amend :overwrite the previous commit
$ git commit -m ‘initial commit’
$ git rebase master #git merge master branch1
1.one branch is the ancester of another -> fast-forward
2.two branch has commom ancester -> recursive strategy
<<<<<<< HEAD
categories:
cd ~/directory move to the working diretory
date: 2016-07-15 00:12:09
git add : add file from working directory to staging area
git banch -v: show all the branchs and each of the last commit
git branch -d branck name :delete a branch;
git branch :show the all the branchs
git branch :show the current working branch
git branch branchname: build a new branch not switch to it
git branch -b [brachname]: build a new branch and switch to it.
git checkout –filename : discard changes in working directory
git checkout branchname :move HEAD to the current working branch to the the branchname
git clean :remove file from working directory
git clone command automatically sets up your local masterbranch to track the remote master branch (or whatever the default branch iscalled) on the server you cloned from. Running git pull generally fetches data from the server you originally cloned from and automatically tries to merge it into the code you’re currently working on.
git config –global alias.br branch : use abbrevation to replace the command
git config –global color.ui true
git config –global core.autocrlf true :slove the differ of line feed between osx and windows
git config –global core.editor [editorname]
git config –global user.email [email]
git config –global user.name [username]
git diff –staged :compare the diff from stagging area to the last commit
git diff –stat :show the diff resume
git diff id1 id2 :compare the diff in two commits
git diff: compare the diff from working directory to stagging area
git fetch remote-name :get data download to a remote project from the url the last fetch address
git init: add .git to the directory to log
git log –oneline –decorate :show the working directory
git log :show the recorder of your improvements q to quit the last commit show the first
git merge branch1: merge branch1 with the current working branch
git pull –rebase : rebase all your changes based on the master(*)
git pull :fetch and merge the remote into current branch
git push origin –delete branchname :delete remote branch
git push origin –tags :share all the tags
git push origin versionname :share tag to the remote
git rebase –onto master branch1 branch2 : move branch2 (based on branch1) rebased on master
git remote :view the remote directory status
git remote add name url: clone a restory to remote
git remote rename oldname newname: rename a remote
git remote rm :remove a remote
git remote show :show more infoemation about a remote branch
git request-pull origin/master myfork : pull pyfork to the public
git reset HEAD filename : unstage a staged file –filename
git rm –cached filename: remove staged file to unstaged.
git rm filename:remove file in memory anf stag area, untracked file
git rm fliename_from filename_to :rename the file
git mv filename :rename the filename and restaged to the stag area.
git show commit_id :show the differ between the commit and its parent
git stash :cached changes without commit
git stash apply :apply the last stash
git stash apply stash@{2} : apply the special stash stash@{2}
git stash list :show your stash list
git status :show the status of the files
git tag -a -m versionname “version specification” :
git tag -a versionname commit_id : tagged the special commit
git tag -a versionname:creat an anotated tag
git tag :show tags avaliable
git tag :show the available tags
mv directory1/filename directory2/filename
photos:
tags:
title: Git Command
two way to merge :