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

  • Home
  • SEARCH
  • 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 7971689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:41:31+00:00 2026-06-04T07:41:31+00:00

We have been trying to get git-subtree working on a project (with git version

  • 0

We have been trying to get git-subtree working on a project (with git version 1.7.9.4) and have run into a bit of a complication. Someone else previous added the subtree with this command some months ago:

git subtree add --prefix=foo git@example.com:foo.git master

Now there have been substantive changes to foo and we’d like to merge in those changes, ideally squashing them in. None of the files have been modified since they were imported.

I’ve tried three things to try and merge in the changes.

First:

git subtree pull --squash -P foo git@example.com:foo.git master

Which throws the exception: Can't squash-merge: 'foo' was never added.

Second:

git subtree pull -P foo git@example.com:foo.git master

This works (sort of), but has the issue of pulling in all of the commits and has conflicts with the files that have been modified.

Finally, I tried this:

git pull --squash -s subtree git@example.com:foo.git  master

This gives me the desired result, with the output Automatic merge went well; stopped before committing as requested and all of the files showing up as modified (with the correct content).

Ideally I’d like to continue using first git-subtree version and get an output close to the last version. If we have to use the last version consistently going forward, we will, but I am a little confused as to why the last one doesn’t produce merge conflicts while the middle one does.

Any help is appreciated.

  • 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-06-04T07:41:33+00:00Added an answer on June 4, 2026 at 7:41 am

    I had the same problem, and in my case it seems to be due to the initial subtree commit being merge-squashed into the master branch.

    Looking through the subtree source I found this: https://github.com/git/git/blob/master/contrib/subtree/git-subtree.sh#L224

    It looks like subtree greps your git log for git-subtree-dir: foo but doesn’t find a suitable commit. Try git log --grep="git-subtree-dir: foo/*\$", and if there’s something weird with that commit, such as it being a merge commit, that could be the issue.

    Just pulling without squashing worked for me, apart from the annoying merge conflicts. I did that in a temporary branch which I then git merge --squashed into another branch to avoid a messier history. It could’ve been rebased instead too of course.

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

Sidebar

Related Questions

I have been trying to get a USB HID keyboard working on an Android
I have been trying to get the FTDI D2xx driver working with my Android
I have been trying to get a simple networking test program to run with
Hi I have been trying to get this script http://jsbin.com/ipajo5/ working but using .live()
I have been trying to learn and get used to version control, more specifically
I have been trying to set up a staging machine to run project at
I have been trying to get yui-css grid system to make a three column
I have been trying to get nServiceBus to work with Ninject 2.0 as the
I have been trying to get LastBootUpTime using Win32_OperatingSystem class (WMI). HRESULT hr =
I have been trying to get this one section of my UI to immediatly

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.