git commands (flow)

Source: Internet
Author: User
Tags git commands

1, configure your information: git config--Globalyour name is git config--Globalyour e-mail--Globalindicates that all git repositories will use this configuration2, create ssh Key ssh-keygen-t rsa-c"[email protected]"git ssh key address Linux~/. SSH window Your user directory has Id_rsa (private key) and (public key) two files copied files in SSH keys on GitHub, click on Add SSH Key to paste the copied information can be used git test command SSH [email protected]3, creating a git repository git initgit Add file name adds files to the Git repository staging area git commit-M"Submission Instructions"submit the file to the warehouse commit is a one-time commit, add can be added many different files, Add. means to add all files4, link a remote repository clone and create a repository git clone [email protected]:xiami99/xiami.git cloning a local library associated remote repository git Remotes add origin [email protected]:xiami99/1234. Git first Git pull origin master then git push origin master git push-u Origin Master-U-parameter git will not only push the local master branch to the remote branch, but also associate the remote branch with the local branch to complete the merge! 5, view warehouse status and modify git status to view git repository status git diff file name see what's changed (typically viewed before commit) git diff HEA D--Readme.txt View the differences between workspace and repository, or view head^Differences in Repository6, view git logs git log show from nearest to furthest commit log git log--pretty-oneline Display less log information git log--graph can view the branching merge diagram git log--graph--pretty=oneline--abbrev-commit to view the merge of the branch git log, please use QQ quit, otherwise you will see a variety of wonderful unpleasant7, undo modify Git checkout--Readme.txt In the Modify command of the discard workspace--very important, no--it becomes a command that creates a new branch that is not submitted to the staging area file, a file that is revoked to the same state as the repository, and is revoked to the same state as the staging area file. Git reset HEAD reade.txt can undo the staging area changes and put them back to work Area8, version fallback git reset--hard head^fallback to previous version git reset--hard Commit-id arrives commit-ID version git reflog is used to record every command you make in Git, with head representing the current version and the previous version as Head^, the first version is head^^, 100th version head~ -9, delete file git rm test.txt confirm delete from git repository with command git rm, and git commit if it's RM test.txt, it can't be added to staging area and commit, use Git rmTen, create a branch git branch view the current branch, preceded by*is the current branch git branch branch name to create a branch git checkout-B dev git checkout switch branch,-b means create and switch One, merge branch git merge dev git merge to merge the specified branch to the current branch fast-forward says this merger is fast-forward, merging fast A, after resolving the merge branch conflict prompt conflict, use git status to view, locate the conflicting file, and then open the Modify<<<<<<<head here is the current branch conflict information=============Test Branch Conflict Information>>>>>>>test then Git add,git commit, and finally you can delete the specified branch. My understanding is that a file merge branch with two identical filenames can only hold the contents of one file -, branch management git merge--no-ff-m"Merge with No-ff"Dev Use--no-FF, a new commit is generated at merge, which can be seen from the branch history, and fast forward merge does not look like it has ever been merged . -, the bug branch git stash the current work site storage, and so on after resuming the scene to continue to work, before storage must first add to staging area git stash list with git stash lis t see where the work site was saved. Git stash apply recovery, but stash content is not deleted, you need to use git stash drop to remove git stash pop recovery while putting STA SH content also deleted git stash apply [email protected]{0} restores the specified stash the, delete branch git branch-d devgit Branch-D Dev If the dev branch is not merged, it cannot be deleted and can be used-d Force Delete -, view remote library information git remote to view the information of the long-range library, default is Origingit remote-v Displays more detailed information showing the origin address that can be crawled and pushed, without push permissions, and cannot see the push address Git supports multiple protocols, including HTTPS, but the native GIT protocol supported by SSH is the fastest

git commands (flow)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.