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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:23:20+00:00 2026-06-13T04:23:20+00:00

Trying to use/learn git with a personal project. There’s only me and a remote

  • 0

Trying to use/learn git with a personal project. There’s only me and a remote git repo, a few commits, and I’m stuck in a failed merge. A lot of my files have Git merge conflict markup now too.

How do I tell git to just throw everything out, just use mine?

A specific example of how I got into the state I’m in:

echo A new file > myFile.txt             # example file
git add myFile.txt                       # add file
git commit                               # commit changes
git push                                 # push changes to remote repo
echo A conflicting edit > myFile.txt     # oh, no, forgot some changes
git add myFile.txt                       # add again
git commit --amend                       # amend previous commit
git push                                 # fails. Git suggests to do a pull first
git pull origin HEAD                     # "Automatic merge failed" Now what?
                                         # Just use what I have locally!
  • 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-13T04:23:21+00:00Added an answer on June 13, 2026 at 4:23 am
    git checkout --ours . # checkout our local version of all files
    git add -u            # mark all conflicted files as merged/resolved
    git commit            # commit the merge
    

    There is a messy alternative that can break the repo for everyone else using the same remote origin. Only consider it if you’re the only one using it:

    git reset --hard HEAD # undo that failed merge
    git push --force      # replace everything remote with local
    

    Explanation (now that I understand git better)
    The reason this happened is because amending commits changes ‘history’. Doing this locally is safe because it doesn’t affect anyone else. However, amending commits that have already been pushed does affect other repos, and is not safe.

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

Sidebar

Related Questions

I am trying to learn how to use lists in C#. There are a
I'm trying to learn how to use lift. I can create project skeleton by
I'm trying to learn Git with the help of Git Immersion . There's one
I am trying to understand and learn how to use subversion or git. Which
I'm trying to follow some tutorials to learn how to use Git but some
I'm trying use Google iosched as a reference project to learn the best practices
I'm trying to learn how to use Git effectively and I'm wondering how I
I am trying learn the use of lambda expressions and hence still struggling to
I am trying to learn and use an SDK for a vendor's product. Unfortunately,
I am trying to learn to use buffer overflow attack in Ubuntu. Unfortunately, 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.