git deletes files from the remote branch

Source: Internet
Author: User

In the beginning, I did not add the. Classpath in the GIT project to the. Gitignore, causing the file to persist in the remote branch so that when executing git pull on another machine, the local. Classpath is corrupted and the reference to the project is problematic. Thus, we need to remove the. classpath file from the remote branch. 1. One idea is to add the. classpath file to the Gitignore so that the. classpath file is not committed at the next commit, but this practice does not cause the. classpath file in the remote branch to be deleted. 2. The following method to solve the problem: in the local project to move the classpath out of the Git repository in a location, equivalent to the Git repository to delete the classpath file;
MV Cps/.classpath.
Modify the Gitignore file, add *.classpath, commit to delete the Classpath version, found that the remote branch of the file has been deleted.
1 git add--all. 2 " Update Gitignore " 3 git push Origin master

Move the removed. classpath file back into the project, and if you commit again, because Classpath has been added to Gitignore, the Classpath file will not be resubmitted.
MV .. /.classpath cps/




git deletes files from the remote branch

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.