1

I have checkout the code few days back (almost a month ago), now i have made same changes but my local copy of code (on my machine) is not updated with the latest code.

now i have to commit my code to team repository in a situation where my local code have some code changes as well as team repository also have some new code.

please help me in simple steps to resolve it.

Thanks !

  • 3
    Possible duplicate of [How to resolve merge conflicts in Git](https://stackoverflow.com/questions/161813/how-to-resolve-merge-conflicts-in-git) – Philipp Ludwig Jul 09 '18 at 10:03
  • Commit your code (without pushing); pull in your teams code; fix merge conflicts until the app runs fine and all tests pass; push your code. I would recommend viewing @PhilippLudwig's link though for a better explanation. – James Whiteley Jul 09 '18 at 10:34

1 Answers1

0

When you make some changes in your code use the "commit" for updating your local repository, once you're ready to send those changes to the remote server you should "push" and your local commits will be added into the remote server.

Now you have your own version of the code different from the remote servers one so you should "merge" them. I recommend you creating a branch to clear the changes and then merge it with the master.

Using a tool like DiffMerge will make your life easier to merge code.

Osakr
  • 1,027
  • 1
  • 13
  • 26
  • Osakr, i am in restricted area where i have no access to external tools, I want to deal the situation only with git batch. can you please elaborate little more in simple steps like : 1. git commit "abc" 2. git push – piyush vijayvargiya Jul 09 '18 at 09:55
  • Before making the push you must be sure that your code won't fuck up the already commited changes in the remote server. So, make a new branch "git branch 'name'" then push your changes to that branch ( you must switch from the master branch to the new branch you created first ). If you don't have any tool to deal with merges you must do it by hand ( as far as I know ) so try using the "git log" and "git diff" to see the changed files and try to merge it with your files. You can configure a merge tool and the use the command "git mergetool" to merge the codes. – Osakr Jul 09 '18 at 10:08
  • how about a `get fetch` and after reading the response, possibly `git pull`. – marlo Jul 09 '18 at 10:15