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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:34:51+00:00 2026-05-31T06:34:51+00:00

My Environment: I am working with team on github private repository. We have only

  • 0

My Environment:

I am working with team on github private repository.

We have only master branch.

Reproduce the problem:

  1. I made change (i talking about single and not muilticase) and add+commit+push to github private repository.

  2. I saw the message in github after my push – and i have mistake that i want to change.

  3. How can I change the message of my push?

Edit:
Its important to me that no history will be left of my mistaken message.

Edit2:
The files already pushed they are in github repository and not only in my local 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-31T06:34:53+00:00Added an answer on May 31, 2026 at 6:34 am

    TL;DR

    git commit -v --amend
    git push -f
    

    This will allow you to edit the last commit message, and replace the commit on the remote with your edits.

    HOWEVER

    You are most likely better off simply pushing a correction.

    The only way to change an existing commit is:

    git add changed # example, add changed to the commit
    git commit -v --amend # launch editor, edit commit message
    

    That will allow you to easily edit your last commit (either contents, or commit message)

    You’ll then find you can’t push to the remote, when you try it’ll be rejected with a warning like this:

     ! [rejected]        master -> master (non-fast-forward)
    error: failed to push some refs to 'git@github.com:xxx/xxx.git'
    To prevent you from losing history, non-fast-forward updates were rejected
    Merge the remote changes (e.g. 'git pull') before pushing again.  See the
    'Note about fast-forwards' section of 'git push --help' for details.
    

    Which gives you two options:

    1. Pull first, before pushing again
    2. Force-push ( git push -f )

    If you pull first – you will put the un-edited commit back in your history, it’ll still exist, but you’ll have no problems pushing to your remote branch. The original commit will show up in the history as a merge.

    If you force-push, you are literally forcing the remote branch to accept your local history and overwriting the remote branch’s history.

    The note from git’s own help is perhaps best used to describe why forcing a push is generally a bad idea:

    Usually, the command refuses to update a remote ref that is not an ancestor of the local ref used to overwrite it. This flag disables the check. This can cause the remote repository to lose commits; use it with care.

    In context, the “lost commits” will be the old version of the commit you edited – but it could also include changes a colleague pushes in-between your first push, and the forced-push. For this reason it’s a risky manoeuvre.

    If you need it it can be done – but either act quickly (so that nobody downloads the borked-commit) or know that you will cause problems for any other developer pulling and pushing to that branch.

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

Sidebar

Related Questions

I am working in an environment with a very small team (3 developers only)
Working in a team environment, we have a Team Foundation Server that also contains
I'm working in a team environment where each developer works from their local desktop
I have a working WAMP environment (Apache Friends). I decided to try Subversion and
I am working in the Linux environment, and I have a C++ program, what
Working in a team environment how would you handle a developer that refuses to
I am working on a large application in team environment. We use to Team
We have TFS 2010 working on-premise in a domain environment. I want to add
I am working in a team environment, and there is already a .gitignore file.
In the team I'm working in we have a big product with many WCF

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.