Git Learning Notes

Source: Internet
Author: User

Recommended Documents: Http://

Two days of contact with git, it feels very powerful and convenient to record some study notes.

Workspace, git Add, git commit, repository--git push, remote repository

The repository head represents the current version, the previous version head^, the previous version head^^ ....

git config--global configuring git

Configure the native git
git config--global "ABCD"
git config--global [email protected]

Git connects to its own github
First step: Create Ssh_key:ssh-keygen-t rsa-c "[email protected]",
After the creation succeeds, the Id_rsa under the. ssh file is the private key, and is the public key
Step Two: Login to GitHub, open "Account Settings", "SSH Keys" page
Step three: Add SSH key, using the public key

Everything from repository sync to remote git has uname and pword action push
The others are directly switching operations from the local

Be sure to clone the repository from your account, so you can push the changes. First fork, then clone.

Git init initializes this folder to the repository
Git add Readme.txt to add files from the workspace to staging area
Git checkout--readme.txt undo changes to workspace files
Git commit-m "This is commit" to submit files from staging area to the repository
Git reset HEAD fallback from staging area to workspace
git diff see Differences before and after workspace file modification
Git Status View file modification status for workspace and staging area
git log View commit log
git log--pretty=oneline
git reset--hard head^ fallback to previous version
git reflog view command history
Git remote add Origin URL renamed "origin" to Git
Git push-u origin master pushes this modification for the first time
Git push origin Master can then not add-u
git clone URL clones a remote library to a local
GIT branch page Create new branch
Git checkout page Select New Branch
Git checkout-b page is equivalent to the above two lines together
Git Branch View branches
Git merge Page Merge branch page to Master,checkout to master branch
Git merge page--no-ff-m "plain" disables fast Forward
git branch-d[d] Page Delete Branch page, switch to master branch before deleting [D forcibly delete]
Git push origin:p Age Delete Remote Branch page
Cat Read.txt Viewing file contents (conflicts)
git log--graph View branch merge situation
git log--graph--pretty=oneline--abbrev-commit View recent branch merges
Git stash hide the current workspace
git stath list view hidden workspaces
git stash apply stash{0} restores hidden workspaces and does not delete stash
git stash drop Delete stash
git stash pop stash{0} restores hidden workspaces and deletes stash
git remote-v viewing remote library information
Git pull Fetch Latest branch
Git branch--set-upstream branchname origin/branchname Specify a link between local and remote
git tag <name> can hit a new tag
git tag View all tags
git tag name ID hit tag
-a specifies the label name,-m specifies the descriptive text
Git show <tagname> can see the explanatory text
When you omit certain files, you need to write. Gitignore;
The. gitignore file itself is put into the repository and can be versioned for. Gitignore!
git config--global status config command alias

Git fetch Origin master:tmp
GIT diff tmp First pull, see the difference, then merge
Git merge tmp
Git pull Origin master pulls and merges

Git Learning Notes

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.