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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:42:17+00:00 2026-05-31T13:42:17+00:00

I often face this problem with git: I clone a git repo of some

  • 0

I often face this problem with git:
I clone a git repo of some project. Then I make changes to some source file, but I don’t commit it, because my work is not complete. But I have to keep updating my repo to make it in sync with the master. So I do a ‘git pull’, so that my repository is up-to-date and so I can produce my patch against the latest repo.
Now suppose I edit the file hello.c in my local clone (not yet committed) and someone else has made changes to the same file and committed it to the master repo. Now when I do ‘git pull’ the other person’s changes get added to hello.c and the changes that I had made, get deleted. This is the natural behavior obviously.
Is there a way to tell git to only ‘add’ changes and not ‘subtract’ anything? Or something to that effect? I don’t want my changes to be deleted when I do a git pull, but also I want to work with the latest repository.

  • 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-31T13:42:18+00:00Added an answer on May 31, 2026 at 1:42 pm
    • As Greg said – “Commit!”. “Commit often, commit fast” is common rule in VCS-world for years
    • Use correct commands for your tasks. If you don’t know all behind the scene of git pull – read FM! Learn difference between pull and fetch or see at examples in Git Reference

    The second command that will fetch down new data from a remote server
    is git pull. This command will basically run a git fetch immediately
    followed by a git merge of the branch on that remote that is tracked
    by whatever branch you are currently in. I personally don’t much like
    this command – I prefer running fetch and merge seperately. Less
    magic, less problems.

    • Use good, bullet-proof workflow. Quote from online git-pull(1) Manual Page

    You never do your own development on branches that appear on the right
    hand side of a colon on Pull: lines; they are to be updated
    by git fetch. If you intend to do development derived from a remote
    branch B, have a Pull: line to track it (i.e. Pull: B:remote-B), and
    have a separate branch my-B to do your development on top of it.

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

Sidebar

Related Questions

I face this often. Suppose I have killed a buffer. And then I go
In process of developing I often face with the next problem: if some method
I often face the problem of wanting to add additional methods to classes I
Often I find myself interacting with files in some way but after writing the
Often I face the problem of mapping the parameter space of one API onto
A problem that I often face with Hibernate is having a list (call it
Often I am stuck with a java class file with no source and I
I've often had this problem in the past and to this date haven't found
Often while working on a branch I need to introduce some temporary changes (such
Often while editing config files, I'll open one with vi and then when I

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.