Git flow and Common Git command
This article is mainly used to record two parts for my experience using git.
The first is the commonly used Git Command, and the second is the process of Git Flow. There are two reference materials that I am learning from and I think is good here.
- 為你自己學 Git : 高見龍

- Colt Steel's course on Udemy. By the way, I bought it after taking another Web Development course on JavaScript/Node.js a long time ago. This course explains a lot of Git principles and how the concept works instead of just only the commanding / coding part, the same goes for his Web course. I think he is a pretty good teacher.
Common Git Command
The following are the common Command I think used quiet often. By the way because I do a lot of personal development, there are relatively few opportunities for me to do reset to old version of application. I have not added so many reset-related commands. In the future I will learn more about it.
Command
Account
git config [user.name](<http://user.name>)
: Get user name
git config --global user.name ”My name”
: Create user name
git config [user.email](<http://user.email>)
: Get user email
git config --global e-mail
: Set e-mail address
Repo
git init
: Create a Repository
git status
: Get Status
git clone
: Clone a repo
Access
ls -a
: Show all files
ls folderName
: Show files in the folder
ls folerName/childFolderName
: show files in childFile
start . / open .(mac)
: Open current folder
start folderName
: Open foler
cd Name of File
: Access name of file
Add & Commit :
git add file name / file name1 file name2
: Stage file / Stage files in group
git add .
: Stage all files
git commit -m “message”
: Commit file
git log file name
: Track commit log
git log --oneline
: List simplified commit log (and all other relavant command, refer to doc)
git amend --
: Modify the last commit
1. git commit -m"xxx":
2. Error found
3. git add xxx: (If you need to re-stage, do this step again)
4. git --amend : revise to last step (this step will open the editor, if the original file needs to be modified, you can also modify it in this step)
Git ignore : After .gitignore file
is created, the files mentioned in the content will not be committed, such as the following files that you want to hide or ignore.- https://git-scm.com/docs/gitignore
- secrets, API keys, credentials, etc.
- DS_store on Mac
- Log files
- Dependencies & packages (node/python)
touch .gitignore
.gitignore file
: create Ignoring Files in .gitignore
Usage of the gitignore
Before commit add, create .gitignore
with the content of the file to be ignored
- .fileName → this file
- folderName/ → files in this folder
- *.log → all .log
- There are other usages that could be refered in the doc
- .gitignore
itself can also be followed up by commit
Branch
git branch
: check branch status
git branch <branch name>
: add a branch
git switch <branch name>
git checkout <branch name>
: above and this are switch
git checkout -b <branch name>
: create and switch to branch in one step
The git doc / git book are very good resources when we need assistance.
Git Flow

We have four branches: Master, Develop, Hotfix, Release
Simply put:
Master : an online stable version
Develop is the development version, and features under development will be merged here.
Hotfix : repairing version
When there is a problem online, it will be branched out from the Master. After the repair is completed, it will be merged into the Master and Developer simultaneously.
Release : a beta version before going online.
It is merged from Developer. After going online, it will be merged into Master and Developer simultaneously.
Feature : a version for developing new features.
It is branched from Developer to develop separate new features.
Personal Development
The above is about team development, but single-person development also has an established flow. I am writing this article also to record it here for my own reference in future development of personal projects.
I refer to this article.

Similar concept of team development.
- Master and origin (remote)
- Development
- Feature(s)
I will try and to see it there is anything I can optimize or make the procedure smoother.