The file in stash server was reverted to a previous revision without any log

We met a problem in git.(We use Atlassian Stash in our team)

A file named "one.py" was firstly changed at 2015/04/01.

Then some other developers pushed a lot of changes to server in the coming days.

Later in 2015/04/08, the "one.py" file was changed again and push to stash server.

Then some other developers pushed a lot of changes to server as usual.

And comes the problem, today (2015/04/09), I found that the "one.py" file was reverted to the revision which we pushed the changes in 2015/04/01. And when I checked the "one.py" file's change history, I can't get the change history in 2015/04/08. It lost. 

What happened? Why we lost the commit history? Can you help me?

Thanks Steven

4 answers

This widget could not be displayed.

Probably your other developers used 'force' push and rewrite the GIT history in Stash.

You can enable 'disable force push' hook in your Stash repository (http://blogs.atlassian.com/2013/03/stash-22-customize-workflow-git-hooks-api-merge-checks/);

More about -force push can be found at Git documentation at http://git-scm.com/docs/git-push.

Simply put, your developers should always keep their local repo up to date by 'git pull' first, merge the conflict if any, then do 'push' to Stash.

Thanks for your answer. But I've already 'disable force push' hook in our Stash repository. So I confused why we met this problem. Devs can't force push changes to stash server. Thanks Steven

Maybe you can double check to see whether that is the case by using 'force push' to a test repo in Stash.

Yes, I've checked that. We can't use force push to a repo which has been disabled 'force push' Thanks Steven

This widget could not be displayed.

Does the commit from 2015/04/08 show up on the Stash server "Commits" page at all?

This widget could not be displayed.

Yes, there is the "commits" information in the "Commits" page.

This widget could not be displayed.

If the commit also shows up locally when you do a "git log" on the clone (and I can't see why it wouldn't), you should be able to retore the file file (to the working directory) by doing a "git checkout <commit> <file>"

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 10, 2018 in Bitbucket

What is your #1 piece of advice to new users getting started using Bitbucket?

Hello Community! My name is Claire Maynard, and I’m a Product Marketing Manager on the Bitbucket team. I’m interested in hearing what advice or tips you have for new users getting started on ...

245 views 14 2
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you