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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:57:19+00:00 2026-06-13T23:57:19+00:00

For example, if I cloned a repository A to some other remote location (

  • 0

For example, if I cloned a repository A to some other remote location (B) over ssh, edited in B, committed, then executed

git push A

When I go back to A, I see that it is now at the latest pushed revision, but it also has some changes staged – the direct opposite of that commit in B, actually. I usually work around it by using

git checkout -f master

but the “-f” flag makes me nervous – for example, there could be some useful changes staged, that I carelessly throw away by doing this checkout.

What am I doing wrong? Is there some better way of doing push/update?

  • 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-13T23:57:21+00:00Added an answer on June 13, 2026 at 11:57 pm

    The intended command would be “git pull” rather than the “git checkout”

    If you have changes that are not committed, you should. This will save the changes that you have and get the new updates. Finally reapply the changes that you originally saved.

    git stash
    git pull
    git stash pop
    

    If you have local commits that you have not pushed yet, you can do. This will rewind your changes apply what was pushed and reapply the commits.

    git pull --rebase
    

    You can just do “git pull” with the commits but that will add a merge commit, that in my opinion dirties the history and can cause some problems.

    I generally do not like the -force option for the reason that you stated. You don’t want to lose anything useful.

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

Sidebar

Related Questions

For example, I have cloned the origin repository on two computers. Then, I go
I got this scenario: I created a Git repository. $ git init Cloned an
First I understand I should probably be using GitHub or some other online repository,
I have a Git repository that includes subdirectories. Example dirA / dirB . Is
I have been working on a system to push changes from my git repository
I am getting some open/closed times as integers since midnight. For example: 1140 =
When you run git clone , it updates progress in place. For example, the
Example: copy in one tmux pane (via vim), then switch to another pane (running
Example: if I want to upload a video to some video service website (such
I have a local git repository a central repo at github. I'm working on

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.