Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1002237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:48:10+00:00 2026-05-16T07:48:10+00:00

I was trying to merge a dev branch into master. git checkout master git

  • 0

I was trying to merge a dev branch into master.

git checkout master    
git pull . dev

Everything seemed to go well, although there were conflicts I fixed these and commited. But when I checked this newly merged working tree is missing a lot of folders and files from dev.

git status  // Shows conflicts & doesn't list some files/folders.    
git commit -a 

Created commit 55ffdd1: Merge branch 'dev' into master  

git diff dev --name-status

Produces:

D       folders/lm.gif
D       folders/lmh.gif
...

So the files/folders that didn’t show up on ‘git status’. It also didn’t show up at the end when I fixed the merged conflicts.

Also when I try to merge again it says:

git merge dev    
Already up-to-date.

Yet the master branch clearly is missing files/folders from the dev branch. Why is that? Shouldn’t that folder and all it’s contents be added? ‘folders’ is being tracked on the dev branch, so shouldn’t it have gotten pulled over when I did the merge?

When there was a merge conflict earlier did git stop the merge process and skipped a bunch of files/folders?

The dev branch had quite a lot of changes, could I have messed something up with git in the past that now certain files/folders wouldn’t have merged?

(When I first created the dev branch I didn’t know what I was doing and did crazy things like reset, reverts etc.)

Hoping one of you git guru’s here on stack overflow knows the answer. 🙂

Thanks,
Quang


Answer

Thanks Walter, Yes this is what happened.

After doing some investigating I found out it was a little complicated what happened. It turned out that.

  1. dev branched from master, it had all the files.
  2. A third branch, lets call it “cleaned”, branched off of dev.
  3. cleaned branch deleted all the files.
  4. cleaned branch merged (or something?) with master. At this point the files were deleted off of master. And the ‘cleaned’ branch disappeared.
  5. on dev, the files are still there and I continued adding to this branch, editing files for quite some time.
  6. dev merged with master and all the files that was deleted previously by cleaned were gone.

Hope this helped someone besides me who learned quite a lot about how to use git log, git show, git reflog trying to debug what happened.

Thanks!

How to Fix

So this is what I did to merge all of the contents in dev that was previously deleted back onto master.

  1. Got all the files/folders that was deleted (on dev but not on the newly merged master) git diff dev --name-status | grep D > deleted_files
  2. Output list of all files and folders git log --name-status > file_history Gonna be using this to figure out the last updated version of the deleted file.
  3. Go through the list of deleted_files one by one, find the the most updated version in file_history and restore it. Example: git checkout 25b8a44 view.php 25b8a44… was the commit with the last updated version of view.php. I tried cherry-pick and just a straight git checkout dev view.php but i found explicitly using the commit id, it merge more of it’s history. (Including the commit that cause the file to be deleted in the first place.)
  4. Once all the deleted files are back a quick check git diff dev --name-status | grep D shows that all files are copied over. Then like Walter said an ammend commit git commit --amend 🙂
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:48:11+00:00Added an answer on May 16, 2026 at 7:48 am

    It sounds like git thinks that the missing files were deleted on the master at some point between where it branches from dev and the pre-merge head. That’s the only reason I can think of for why git would silently drop tracked files during a merge.

    Unfortunately, I don’t know a good way to fix that. I’d probably just re-add all the deleted files from the dev branch manually (or with a little bit of bash scripting), and then to a git commit --amend to revise the merge commit to include them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to merge my dev branch into the master branch but as
I am trying to merge the latest changes from trunk into a branch of
I am trying to merge the data from two tables into one result but
I am trying idiomatically merge multiple maps into a single map using clojure. Input
I am looking for some advise with git and push / pull and trying
I'm trying to merge to sorted arrays into a third sorted array , but
I am trying to merge files into an output file and my individual files
Well i'm trying to merge multiple PDFs in to one. I gives no errors
I am trying to merge two ggplot2 plots into one based on this table:
I'm simply trying to merge 2 xml documents (adding nodes from one into the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.