Git
There should have many type of distributed workflow. This note should focus on Subversion-Style Workflow, i.e.:
Other workflow example please check here
Terminology
Repository
In simplified version, it means the project that is under the git control.
Detailed explanation, is the object database of the project, storing everything from the files themselves, to the versions of those files, commits, deletions, etc.
Remote / Origin
Origin is conventional name for the primary version of a repository. Mostly means the repository copy that's in the centralised server(e.g. gitlab, github).
Remote means the repository copy from the Origin, e.g. the copy that in developer's local server.
Remote can interact with Origin, to sync the progress of the repository.
Commit
A node of git repository, which stores a snapshot in the history of the repository.
Branch
A version of the repository that diverges from the main working project on any purpose, e.g. new feature, bugfix, testing, etc.
Command
git remote
git remote set-url origin <new.git.url/here>
Assign git repository url to current directory. This case usually used to update or mark the origin repository's location.
git status
check status of the repository
git diff
git diff <filepath list>
compare the file with it's previous commit. if not any filename input will list out all file difference.
git checkout
git checkout [-b] [origin/]<branch name>
used to switch branch, file update may be keep.
-b
flag used to create new branch before switch to it. origin/
used to
git add
git add <filepath list>
prepare files listed into staged list, which is pending to commit.
wildcard (*) is supported
git commit
git commit [-- <filepath list>]
Create a commit containing the current contents of the index and the given log message describing the changes.
Editor will revealed to input the commit message.
git push
For no branch in origin case:
Reference
Last updated