Git merge develop into feature branch outputs "Already up-to-date" while it's not
Sophia Terry
I checked out a feature branch from develop called branch-x. After a while other people pushed changes to the develop branch.
I want to merge those changes into my branch-x. However if I do
git merge develop it says "Already up-to-date" and doesn't allow me to merge.
git diff develop shows that there are differences between branch-x and develop.
How do I merge develop into branch-x?
5 Answers
You should first pull the changes from the develop branch and only then merge them to your branch:
git checkout develop
git pull
git checkout branch-x
git rebase developOr, when on branch-x:
git fetch && git rebase origin/developI have an alias that saves me a lot of time. Add to your ~/.gitconfig:
[alias] fr = "!f() { git fetch && git rebase origin/"$1"; }; f"Now, all that you have to do is:
git fr develop 7 Step by step self explaining commands for update of feature branch with the latest code from origin "develop" branch:
git checkout develop
git pull -p
git checkout feature_branch
git merge develop
git push origin feature_branch 4 git pull origin developSince pulling a branch into another directly merges them together
git fetch && git merge origin/develop 2 Initially my repo said "Already up to date."
MINGW64 (feature/Issue_123)
$ git merge developOutput:
Already up to date.But the code is not up to date & it is showing some differences in some files.
MINGW64 (feature/Issue_123)
$ git diff developOutput:
diff --git
a/src/main/database/sql/additional/pkg_etl.sql
b/src/main/database/sql/additional/pkg_etl.sql
index ba2a257..1c219bb 100644
--- a/src/main/database/sql/additional/pkg_etl.sql
+++ b/src/main/database/sql/additional/pkg_etl.sqlHowever, merging fixes it.
MINGW64 (feature/Issue_123)
$ git merge origin/developOutput:
Updating c7c0ac9..09959e3
Fast-forward
3 files changed, 157 insertions(+), 92 deletions(-)Again I have confirmed this by using diff command.
MINGW64 (feature/Issue_123)
$ git diff developNo differences in the code now!