Common git commands

Source: Internet
Author: User
Tags git commands

1. Cancel tracking of certain files or folders:

Delete an object:

$ Git Rm -- cached filename

Delete a folder:

$ Git Rm-r -- cached path

2. Ignore some files or folders

$ VI. gitignore

Every row in the file is an ignored item.

AA. Log, ignore AA. log;

*. Log: Ignore files ending with. log;

Pod/*, ignore all folders under the pod directory

3. Merge multiple commits:

$ Git rebase-I head ~ 2

Change the second pick to squash or S, and enter ": WQ" to exit.

Git automatically merges the second commit to the first commit. And prompt to enter a new message (which we often call comments)

Edit and enter a new message, and then enter ": WQ" to exit.

At this time, the last two local (head) commits have been merged into one. Git log can be viewed.

If you need to submit it to the remote end, run git push -- force origin master.

Common git commands

Related Article

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.