git version management commands

  • git init: initialize the git repository
  • git add filename: add the file to the staging area
  • git commit -m "description": commit the staging area information to the repository
  • git status: Check the current warehouse status, that is, check whether there are no submitted file modifications
  • git diff: View specific modifications
  • git diff HEAD - filename: see the difference between the latest version in the workspace and the repository
  • git log: view the commit log
  • git log --pretty=oneline: only view modification information
  • git reset –hard HEAD^: go back to the previous version (the version pointed to by HEAD is the current version)
  • git reset --hard HEAD^: go back to the previous version
  • git reset --hard HEAD~100: go back 100 versions up
  • git reset –hard version number: used to specify a future version after the rollback version operation (the version number does not have to be written in full)
  • git reset HEAD file name: undo the modification of the temporary area and put it back in the work area
  • git reflog: View executed commands
  • git checkout --filename: discard workspace modifications
  • git rm filename: remove file from repository
  • git push: push local content to remote repository
  • git clone: ​​clone a local repository from a remote
  • **
  • git checkout -b branch name: create and switch to the newly created branch
  • git branch branch name: create branch
  • git checkout branchname: switch to branch
  • git branch: view the current branch
  • git merge branch name: merge a branch into the current branch
  • git branch -d branch name: delete the specified branch
  • git log --graph : View the branch merge graph
  • **
  • **
  • **
  • **
  • **
  • **
  • **
  • **
  • **
  • **

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324810560&siteId=291194637