Git basic operation--command, really only the most basic operation __git

Source: Internet
Author: User
Tags diff git clone

GIT basic Operations Command, temporarily only the most basic operation, excerpt from the first line of code.

install Ubuntu system to open the Shell interface, enter: sudo apt-get install git-core windows system to download the website. URL: http://msysgit.github.io/
Initial initial configuration user name, mailbox:

git config--global user.name "Tony" git config--global user.email "tony@gmail.com" to see if the configuration was successful (remove the last name and mailbox):
git config--global user.name/git config--global user.email Initialize, create a code warehouse (after creating a project, go to the project root directory):
Git init can then use: Ls-al to view all the files in the current directory, one more. git Add files/Folders/all:
git add androidmanifest.xml//Add a single file git add src//Add folder git Add. Add all Submit:
Git commit-m "the" "I" note that we must use the-m parameter to add the submitted descriptive information at the end of the commit, and the submission without descriptive information is considered illegal. Ignore file: Create a file named. Gitignore in the project root and edit the content

The specific add rule is: file represents a specific file; Directory representative folder; Mask represents a class of files
File:local.properties/local.properties Directory:. gradle/. idea//.idea/workspace.xml/.idea/libraries build//build App/build/also has a third party dependent library build folder Mask: *.iml To view Modifications:
git status To See what you modified:
git diff only looks at changes to a file:
git diff Src/com/example/providertest/mainactivity.java Undo Uncommitted Changes(for example, we've just modified the contents of the Mainactivity file and now if you want to undo this change you can use the Checkout command and check it with the git status command):
git checkout Src/com/example/providertest/mainactivity.java undo a file you've added(as already added, first the latch to add, and then use the Checkout command to undo the modification):
git Reset head Src/com/example/providertest/mainactivity.java To view submission records:
git log
When there are a lot of submissions, if we just want to view one of the records, we can specify the ID of the record in the command, plus the-1 argument that we just want to see a row of records, as follows: Git log 2e7c0547af28cc1e9f303a4a1126fddbb704281b-1 and if you want to see what is specifically modified in this commit record, you can add the-p parameter to the command, as follows: Git log The results of the 2E7C0547AF28CC1E9F303A4A1126FDDBB704281B-1–P query are shown in the figure, where the minus sign represents the deleted part and the plus sign represents the added part.
To View a branch:
Git branch-a To Create a branch:
Git branch version1.0 Toggle Branch:
git checkout version1.0 Merge branches: (first switch to Master branch, then merge)
git checkout master git merge version1.0 To delete a branch:
Git branch-d version1.0 Clone Warehouse (assuming the GIT address of the remote version library is: https://github.com/exmaple/test.git)
git clone https://github.com/exmaple/test.git local modifications are synchronized to the Remote version library:Where the origin section specifies the Git address of the remote version library, the master section specifies which branch to sync to, and the following command completes the synchronization of the local code to the Https://github.com/exmaple/test.git version library. Functions on the Master branch.

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.