Typical workflow of Git-SCM
2018-03-04
Typical workflow of Git-SCM
Local
git clone url
:clone a repository from url.git branch [branch-name]
:create new branch to modify.- make change.
git status
:check file changed by not staged.git checkout <file>
:reset file to last commit.git diff [file]
:check difference of file between stagedgit add [file ...]
:snapshots the files in preparation for versioning.git reset [file ...]
:unstage the file,but preserve contents.git commit -m "[description]"
:records file snapshots permanently in version history.- back to 3.
With remote
based on commit
1. git fetch [bookmark]
:download all history from the remote repository bookmark.
2. git merge [bookmark]/[branch]
:combines bookmark’s branch into current local branch.
3. git push [alias] [branch]
:upload all local branch commits to remote repository.
With upstream(special remote)
based on commit
1. git remote -v
:review all remote repositories.
2. git remote add upstream <upstream url>
:add upstream repository.
3. git fetch upstream
:downloads all history from the upstream.
4. git merge upstream/master
:combines upstream to local master.
Relationship
upstream
/
local
remote