It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Only local branch is resetted, remote branch remains unchanged

Coding Bart Oct 11, 2017

A good day,

When I do the command 'git reset --hard HEAD~2' in my local branch, everything in my local branch is indeed set back 2 commits.

So if I git 'git status' i am behind two commits by the remote branch. But the whole point is to reset the remote branch back 2 commits as well. 

 The documentation says this about it: "Eventually, such dangling commits will be pruned through the garbage collection". 

But, still hours after doing the git reset, the remote branch is still unchanged, and my local branch is still 2 commits behind. Then, the only way is to do git pull to make things even again.

What am I missing here? I just want the remote AND local branch to be resetted an 'x' amount of commits. 

I am looking forward to some answers. Many thanks in advance!

 

2 answers

1 vote
Ana Retamal Ortiz Atlassian Team Oct 12, 2017

Hi Bart! After you perform the git reset in your local branch you need to push these changes to the remote repo. You can do this by using git push --force to force push the change.

git push --force 

Once you push your changes Bitbucket will automatically run an aggressive git gc to rewrite the history and reflect your change, this can take up to 60 minutes. If the gc doesn't happen, let us know.

Hope that helps :)

Ana

0 votes
Shannon Spaniol Atlassian Team Oct 11, 2017

Hi there,

Could you clarify which product you're referring to? Confluence does not use Git or Commits. I'd like to move your question to the proper product.

Thank you!

Kind Regards,
Shannon

Coding Bart Oct 12, 2017

Sorry, I did not see the tag. Tag changed to the Bitbucket product.

Shannon Spaniol Atlassian Team Oct 12, 2017

No worries, Bart! I also have moved your question to the Bitbucket collection.

Thank you for updating the tag.

Kind Regards,
Shannon 

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

1,964 views 1 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you