Home > Enterprise >  Git common commands
Git common commands

Time:09-18


Workflow: the workspace - & gt; The staging area - & gt; Repository

Initialization: git init - & gt; Git add - & gt; Git commit

Remote warehouse: git remote add - & gt; The git pull - & gt; Git push - & gt; Git clone

Branch management: git branch - & gt; Git checkout - & gt; Git merge

Label management: git tag - & gt; Git push


Git clone "project address" - b "branch name" (branch), pull the specified
Git checkout - b branch branch (create)
Git branch branch branch (create)
Git checkout branch switch (branch)
Git branch branch (see local branch)
(see the git branch - a local branch and remote branch)
Git push - set - upstream origin branch name (push local branches to the remote warehouse)
Git checkout - b local branch name origin/remote branch name (remote branch pull to the local, at the same time create a local branch)
(if the pull is not successful, perform first git fetch)
(if the current local branch is hello_branch)
Git push origin hello_branch: master (hello_branch branch to submit to the master of the remote warehouse)
Git pull origin hello_branch: master is the master of the remote warehouse and merge local hello_branch branch merge)
Git add "file name" (add specific files to the staging area)

Git add. (add all files to the staging area)

Git commit -m XXX (added to the local repository)

Git status (view is the current state)

Git branch - d branch branch (delete)

The mkdir filename (create documents)

Git init initialization (git)

How to tie the tag label, submitted to the remote warehouse first, in the tag.

Echo their content & gt;> File name (add content to a file)

Git add filename (put the files in the staging area)

Git commit -m submit description (put files on the local repository)

Git push origin branch name (the documents submitted to the remote warehouse)

Git tag (see label)

Git tag tag name (tag)

Git push origin tag name (submit tag to the remote warehouse)

The git log (see commit id)

Git reset - hard version id (- hard - force the buffer zone and the working directory is synchronized to your specified submit)

Git merge branches name (merge branches into the current branch)

  • Related