gitgithubgit-pullgit-track

Updating local branch from the tracking remote branch without losing changes in local branch


I have cloned a remote branch A from github, and checked out a local branch feature/test from it

For example -

git clone A
git checkout -b feature/test

Now i started working on feature/test and did some changes in it and commited but not pushed. Now the remote branch A has been updated with latest commits from someone, so i want to update my local branch feature/test and take these latest changes from remote A. How can i do this with out losing my local changes.

Note - my local changes from branch feature/test has already been commited but not pushed.


Solution

  • The problem is a very common one, what you can do is that you can change the base of your branch. You can follow the steps below

    Here you can face a conflict (maybe) so you have to resolve that too before you can successfully get those changes.