File status and usage in git

Source: Internet
Author: User

(Staging area = index in Git)

Commit to local respository content, do not want to push, then use git reset to turn the file state to staged|modified|unstaged:

git reset head^
git reset--soft head^
git reset head~3 (local 3 commit uncommitted, or git reset head^ operation 3 times)

State rotation with Git reset

The deleted content is not push to the remote position and you want to restore the file:

git checkout [--] <file or path> (--optional)

Git pull, some changes do not want to commit to the local warehouse, you can git stash, the following three steps:

1. Git stash
2. Git pull
3. Git stash pop

View the status of the current warehouse in a tree structure:

GITK--all &

git delete files:

1. Delete the file from the repository while the current working directory (disk) is also deleted
git rm <file>
Git rm-r <path>

2. Delete the file from the repository, but the file remains on the current working directory (disk)
git rm--cache <file>
git rm-r--cache <path>

File status and usage in 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.