简体   繁体   中英

GIT Partial Update local files

I never used GIT before, so, I'm a newbie. And I have a complex task for git. For example, I have a directory on server (local), where I installed some app from nightly repository by apt-get install. I made some changes in app code, in a different files and directories. After that I committed this new custom version on bitbucket. This is a second point of my tasks. And the third step: I updated current app through apt-get update/ apt-get upgrade app. So, first of all, how I can change my local current app with remote custom app? When I try to use "git pull repository", it says 'Already up-to-date'. And the second question: when I updated current app with apt-get upgrade, how I can pull only custom files from bitbucket?

For example, after app installation I have a next structure

Folder1 / File  version A
Folder2 / File1 version A
          File2 version A

After my custom updates and commit to bitbucket:

Folder1 / File  version B
Folder2 / File1 version A
          File2 version B

After apt-get upgrade:

Folder1 / File  version C
Folder2 / File1 version C
          File2 version C

Now I need next structure in local:

Folder1 / File  version B
Folder2 / File1 version C
          File2 version B

How can I do this?

You can discard changes to your working copy state by using git checkout -- path/to/file

You should be able to get the state you want by running

git checkout -- Folder1/File
git checkout -- Folder2/File2

which is effectively resetting the state of the files to the one you have in version control. Note that this may lead to the app breaking, since not only your changes are applied, but also the changes done in the update are reversed!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM