Reset commit of remote branch

0 votes

Reset commit of remote branch

Branch A

git add modify files
git commit -m "ISSUE FIX A"
git push origin A

Found problems from ISSUE FIX A commit, so I want to reset this commit

git reset HEAD^
git commit -m "Reset commit HEADNUM"
git push origin A

then error message

 ! [rejected]        BRANCH A -> BRANCH A (non-fast-forward)

How to reset commit of the remote branch?

Aug 13, 2018 in Git & GitHub by Hannah
• 14,080 points
27 views

2 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
use git push --force origin A Because you are trying to edit the history.

you can amend your commit without using git reset by using git commit --amend to amend the last commit.
answered Aug 13, 2018 by Kalgi
• 35,720 points
0 votes

Just fix the issue on your local, save it and:

git add .
git commit --amend --no-edit
git push --force-with-lease

The commit and its hash will change keeping the same commit message. The --force-with-lease overwrites your remote branch with your local, unless someone else committed on it.

answered Aug 13, 2018 by Nilesh
• 6,900 points

Related Questions In Git & GitHub

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

meaning of check-in code in github

It simply means to upload code to ...READ MORE

answered Apr 29, 2018 in Git & GitHub by ajs3033
• 7,000 points
62 views
+13 votes
2 answers
0 votes
1 answer
0 votes
2 answers

difference between git remote and git clone

git remote add just creates an entry in ...READ MORE

answered Aug 7, 2018 in Git & GitHub by Kalgi
• 35,720 points
222 views
0 votes
3 answers

error cloning remote repo 'origin'

Follow these steps: Go to Manage Jenkins Go to ...READ MORE

answered Apr 24 in Git & GitHub by Bina
1,268 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.