Search code examples
gitgithubpull-requestgit-pull

how will I do PULL with keeping local changes in GIT


As a team we are working on same branch in GIT. Now I want to check in my changes. But before that I need to do a pull. Its giving me a warning to clear my local changes before doing pull. How can I do a pull while making sure to keep local changes.


Solution

  • Git's pull operation is a high level operation that does two things:

    1. Downloads or fetches the commit history from the server
    2. Merges or rebases the current branch on to its upstream.

    These operations can also be done stand alone. This is the workflow I'd recommend:

    1. Commit any uncommitted changes (you may also use git stash but I find it is easy to forget about the contents of your stash during the conflict resolution step)
    2. Use git fetch to check for any upstream changes
    3. Inspect the upstream changes using git log
    4. git rebase
    5. Resolve conflicts