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 6865153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:00:22+00:00 2026-05-27T03:00:22+00:00

On my local branch, I have some personal (local-only) changes to a Makefile (just

  • 0

On my local branch, I have some personal (local-only) changes to a Makefile (just changing the path to the compiler). Obviously I don’t want to commit those changes in as they are only relevant to me. However, if I don’t commit them then I get an error when I try to sync with the remote branch:

% git fetch upstream
% git merge upstream/master
error: Your local changes to 'Makefile' would be overwritten by merge.  Aborting.
Please, commit your changes or stash them before you can merge.

Stashing and then un-stashing the file every time this happens seems tedious. On Perforce for example, you would just move those file(s) to a separate change list and resolve merge conflicts where necessary.

What I want to happen is for git to automatically merge my local Makefile with the remote one (where possible), but without having to commit it. How would I got about doing that?

  • 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-27T03:00:22+00:00Added an answer on May 27, 2026 at 3:00 am

    There are likely several ways to approach this problem, here’s my thought.

    Make a new makefix branch and commit the makefile there. Whenever you need to make the project, switch to that branch. You can work in master and just keep merging, or rebasing the makefix branch against master.

    The general idea is that you’re creating a branch containing your Makefile that is never pushed.

    Personally I would rebase makefix against master so my Makefile changes always stayed ahead of the actual pushable code. It just feels cleaner in my head.

    Code Example

    git branch makefix
    git checkout makefix
    

    Make your changes to Makefile

    git add Makefile
    git commit -m "Add Local Makefile Changes to Compiler Path"
    

    For every-day work

    git checkout master
    git fetch upstream
    git merge upstream/master
    
    git checkout makefix
    git rebase master
    

    It’s long and ugly, so I hope someone else has a better way =]

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

Sidebar

Related Questions

I have local folder that is branch from formal_versions. My workflow is: Mkae changes
I have created a new branch in my local repository and after some commits,
I have a commit xyz in my local branch that I want to check
I have some local files, I pull from remote branch and there are conflicts.
I have created a local branch X that at some point I pushed to
I have a local branch named ' my_local_branch ', which tracks a remote branch
I have a local branch work, where I created two new files a.py, b.py
Lets say I have the following two branches and the local branch is 'mybranch'
I have a local topic branch that's tracking a remote branch. For the sake
I have already got a local master branch tracking the remote master branch of

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.