Basic operation

  • Clone the project (and switch to the specified branch)

Git clone [-b] Git clone Example: git clone -b dev

  • View current project status (concise form)

git status [-s]

  • Get the latest remote code

git pull

  • Add all the changes to the staging area

git add .

  • Adds the specified file from the workspace to the staging area

git add file-name

  • Adds staging area contents to the repository

Git commit -m

  • Push repository content to a remote branch

Git push origin: git push origin bugfix-xxx_yyy

  • Push repository content to the newly created remote branch

git push origin :

Branch management

Git branch -r git branch -a git branch -vv

Create a local branch. If the remote branch has the same name, the remote branch is automatically associated with the remote branch. If not, associate it with the current remote branch git branch dev

Git checkout Git checkout dev

Git checkout -b git checkout -b dev

Git reset –hard origin git revert git revert -m 1

gitflow