Android Learning notes (a) Git-related configuration and usage

Source: Internet
Author: User

First, the configuration

Open git Bash,

" username " " [email protected] "
Second, create the Code warehouse

Create a new folder, under the folder Git Bash, and then enter

Git init

You can create a code warehouse. A hidden folder appears under the current folder. Git.

Third, submit the code
" wrote a readme file "

Where-M is followed by a comment on this submission. Be sure to add and post commits first.

If you want to add all the files under the folder, you can enter git Add. If you want to ignore a portion of a file or folder, you can create a new. Gitignore under the current folder, and then enter what you want to ignore, such as

/bin/project.properties
Iv. Viewing the modified content

After modifying some of the files in the code warehouse, you can enter Git status to view the changes and enter Git diff to see what's changed.

V. View submission Records
git log
Vi. Undo Uncommitted changes (you only need to enter the second command if you haven't added one)
git reset HEAD src/example.javagit checkout src/example.java
Vii. fallback to previous versions
git reset--hard ^head

Head indicates the current version;

^head (or head~0) indicates the last submitted version;

^^ the last committed version of HEAD (or head~1), and so on.

This can also be overridden by the version number (which can be a few of the previous versions, typically 7-bit).

Viii. view all records for all branches
Git reflog

Note: Git log is not able to view the version after reset is deleted, and the above command can.

Android Learning notes (a) Git-related configuration and usage

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.