In my project, I have many staged files which are inline configured at many places with my localhost settings which I am not willing to push to server. and the server files has settings of external server which I am not willing to pull.
So actually, I am looking for a way where I can partially push/pull the changes to/from the server, respectively.
I think I am missing some basic concepts of dealing with Git here. So, I will explain how I am managing things now:
I keep two directories of same project, one for to communicate to git (git directory) and other where I work (working directory). So, whenever I do changes in working directory which are ready to commit, I do the following:
- Pull server changes in git directory
- Compare working directory with git directory using third party tools like Beyond Compare
- While comparing step by step, I can easily solve any merge conflicts and insert partial necessary code in working directory from git directory.
- Push the new git directory changes to server.
Pros:
- There will be no scenario of merge conflicts as the git directory has only the code from server.
- I will have a extra backup of my project.
- Can easily manage push/pull of partial code to/from server, respectively.
Cons:
- Need to manage code in two directories i.e git directory and working directory.
- Sometimes while comparing working directory with git directory, there is a high possibility of missing some files to compare.
I don't know whether I am doing this right or not as you can see I am using git only to push or pull the changes.
Please let me know whether I can do the same using git completely without depending on maintaining two directories or using Beyond compare like tools.