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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:31:29+00:00 2026-05-25T17:31:29+00:00

I am the sole developer on a project. As an example, say I have

  • 0

I am the sole developer on a project.
As an example, say I have the following scenario:

Office A – make changes to code, commit then push

Office B – try to pull changes, but if any changes made it complains. I want to forget any changes made and get the latest version.

Basically I am switching between offices A & B, and each time I want to commit changes to the remote repository, and then get those changes again from the next office. Git will complain as there might be some minor changes in the working copy. I’ve been using git reset –hard followed by a pull, but this doesn’t feel right somehow. I’ve looked at stash too but that seems to save changes somewhere for use at a later time.

The number of commands for git seems bewildering!

  • 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-25T17:31:29+00:00Added an answer on May 25, 2026 at 5:31 pm

    You (and git) are doing it exactly as you should. You’re not using git incorrectly; it’s intended to be able to push and pull from different places just like this.

    The reason git complains to you, is because it’s required by the changeset model: Suppose on machine A, you made a commit with hash “abcdef”. In order to be able to share changesets between the repositories, like you want to do, commit “abcdef” must be exactly the same, everywhere. On machine B, when you pull that commit into your local changes, it might put that commit into the history in some particular place, but it cannot mix that commit with your local changes. Doing so would produce commit “3dea12”, which is entirely different.

    Git could try to mix your changes on the fly, like subversion does. Consider, though, if you had committed six times: now you have to merge six times, once for each (indivisible) commit applied on the other machine. Subversion gets around this by summarizing the changes in an all-in-all blob of a diff, which it then tries to put on top of your local changes. It works sometimes, but some of the merging gets kinda screwy and it doesn’t let you keep the neat, changesets-never-change history that git offers.

    To solve your problem, here’s your pull strategy on machine B:

    $ git stash       # Set your uncommitted changes aside for a moment
    $ git pull        # Pull in the new changes
                      # <resolve conflicts, if they happen>
    $ git stash pop   # Bring back your uncommitted changes, fixing ambiguous
                      #     merge pieces as necessary.
    

    Basically, this is the, “don’t worry, git stash isn’t scary,” strategy. 🙂

    I think it’s important to notice that you will have to merge. Good development practices, keeping changes small and so on might make merges happen less often, but you will still have to merge sometimes.

    By the way, you want git to complain. If your working copy is clean (no stashes needed), you’re mixing one history with another. Git will find the spots where you need to merge and ask you what to do. It’s a pretty clear process. If it has to conflate those spots with local changes as well, the history would get very confusing. That would essentially be merging things from the past with things from “the future”, which in this case is your uncommitted work (that will probably change!).

    In light of that, here’s your other option:

    $ git commit -m "..."    # Commit your local changes, making them part of history.
    $ git pull               # Clean working copy! (maybe merging required)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small project on git, on which I am the sole developer.
I'm the sole developer working on a couple of webapp sites. I have them
I'm the sole developer at my job and we currently do not have any
I'm the sole developer for an academic consortium headquartered at a university in the
I am the CTO and sole developer for my company. I'm getting ready to
It's been mentioned to me that I'll be the sole developer behind a large
Say I've got a class where the sole data member is something like std::string
I am the sole .net developer for a small company. My projects span many
In order to improve my open source project, I need testers. I have created
I use EntitySpaces for all of my Database related coding. As a sole developer

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.