Git [remote Rejected] XXXX-> XXXX fixed the push branch error

Source: Internet
Author: User

Git is really a magic tool. Today it took an hour to solve the problem of synchronization of this branch, and it has also improved a lot in understanding of the branch.

"Git GC" is a good command, which can be optimized and run without any problems.

The error message is as follows:

Git push origin xxxx

....

[Remote Rejected] XXXX-> XXXX <no such ref>

.....

After checking SOF and other places, you cannot solve your own problems. Instead, you can only try gitref.org A Little Bit. Of course, the backup database is required.

I found that it was really fast to understand and learn while trying. Many git concepts are clear and I have read a lot of documents, but I don't have a ref.

All right, everyone knows the ref = reference. In fact, this concept is normal, because it is a pointer or a reference, and the written understanding is that the pointer does not exist. Is it damaged by me, all the fixes have failed.

I had to delete and re-create and re-Synchronize. The reason why I didn't dare to do this at the beginning is that there is always a kind of synchronization concept in my mind. Imagine if I deleted remote data and synchronized it, my local files will not be deleted.

Git push -- delete origin XXXX // Yes, push has the ability to delete and create remote branches. Branch is a disability.

Git push origin XXXX // push up, of course this XXXX branch will be automatically created

Git Branch -- Set-upstream VIP-1st origin/VIP-1st // associate a local branch to a remote

Git pull // used to check the results, which can be left empty

 

Haha, it's really good ~

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.