Some common commands about git

Source: Internet
Author: User

1.git init turns the directory into a repository that git can manage

2.git Add File to Warehouse

3.git commit-m "" Submit the file to the warehouse,-M followed by the submission instructions

4.git Status View the current status of the warehouse

5.git diff file name See what has been changed this command is used before the file is submitted to the warehouse

6.git log shows the commit log from the nearest to the farthest

If too many output information, see dazzling, you can try to add --pretty=oneline parameters

git log--pretty=oneline

7.git Reset--hard head^ set HEAD to previous version

8.cat FileName View File contents

9.git reflog View command history, repository version number ID via git reset--hard version ID, shuttle to each version

10.git Checkout. Get this file back to git commit the last git add state or time

11.git Reset can undo staging area changes, re-put them back in the workspace, and git checkout.

Delete a file or folder 12.RM-RF file name

13.defaults Write Com.apple.Finder appleshowallfiles YES

Killall Finder

See if there is a id_rsa.pub file under the. ssh file, and then copy it to GitHub without:sssh-keygen -t rsa -C "[email protected]"

14.git remote Add Origin warehouse address associated repository

15.git Push Origin Master pushes all contents of the local library to the remote library

git push origin:master keeps the local repository and empties the remote repository

16.git remote-v viewing the associated remote warehouse

17.git Remote RM Origin Decommissioning the connection to the repository

18.git Clone warehouse address from a remote cloned project

By default, the same folder name is created with the remote, clone to the specified folder followed by

git clone repository Address folder name

19.git checkout-b Branch name origin/branch Name

Clone a branch from a remote repository to a local, remote without a branch, git checkout-b branch name, create a branch and switch past

20.git branch-v View all branches

Git branch-r View all branches of the remote repository

21.git branch-d Branch Name Delete Branch

22.git Checkout Branch Name Switch Branch

24.git Pull Origin Next:master

Retrieve the next branch of the Origin host, merging with the local Master branch. The same as the branch name.

25.git fetch origin  git merge origin/master

This command means to update all branch contents of the remote repository and then merge the remote Master branch with the local master branch

http://blog.jobbole.com/71091/

Some common commands about git

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: info-contact@alibabacloud.com 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.