What did git pull--rebase do? and cannot rebase:you have unstaged changes solution _git

Source: Internet
Author: User

Recently learned Git rebase, feel very cool appearance,
It turned out to be a slap in the face today.

Git pull--rebase

Error:

Cannot rebase:you have unstaged changes please
commit or stash them.

The first reaction is:
No. Can Yes. Just now it was clearly submitted. How can there be changes. Hysterical.

Finally with git status a look:

。。。。

I was wrong... Take a call and forget about the deletion of the file--. Summary: 1.git pull–rebase Understanding

This command does the following:
A. Take the contents of your commit to the local warehouse and remove it to the registers (stash) (at which point your workspace is clean)
B. Then from the remote pull the replacement code to the local, because the workspace is clean, so there will be no conflict
C. Remove from registers the content you submitted before and merge with the code you pulled down.

So rebase make sure your local workspace is clean before pulling the code, and if your locally modified content is not fully commit or stash, you will rebase fail. 2. Or to listen to Git tips, to be sensible, what is not clear, input

git status

According to the person's prompt, the submitted submission, stash the stash. 3. After deleting files, you need git add-a, just git Add. No, the difference is as follows:

Several parameter differences for git add

Git add-a Save all the changes
git Add. Save new additions and modifications, but do not include deletion
Git add-u saves changes and deletes, but does not include new files.

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.