Github desktop как откатиться
Перейти к содержимому

Github desktop как откатиться

  • автор:

Как в GitHub Desktop вернуть проект к нужному коммиту?

Я уже задавал подобный вопрос, но сейчас ситуация немного другая.
Нужно вернуть проект к нужному коммиту.

А именно — как сделать два разных варианта «переключения»?
1) Переключиться на коммит и продолжить работу с него. (git checkout -b имя-новой-ветки aaaaaa). Возможно без новой ветки?
2) Переключиться на коммит удалив все коммиты выше.
Если есть какие либо текущие изменения — то сохранять их не надо.
Переключение на коммит для продолжения работы, а не просто посмотреть.

Как это сделать в GitHub Desktop?
60e46d288e99f472641203.png
60e4714631a6a472838331.png

  • Вопрос задан более двух лет назад
  • 789 просмотров

5 комментариев

Простой 5 комментариев

Отмена фиксации в GitHub Desktop

You can use GitHub Desktop to revert a specific commit to remove its changes from your branch.

When you revert to a previous commit, the revert is also a commit. The original commit also remains in the repository’s history.

Tip: When you revert multiple commits, it’s best to revert in order from newest to oldest. If you revert commits in a different order, you may see merge conflicts.

Screenshot of the

  1. In the left sidebar, click History.

Screenshot of a list of commits in the

Right-click the commit you want to revert and click Revert Changes in Commit.

Further reading

bazuzu931 / github откат на локалке и на самом сайте

This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters

Ситуация когда у вас уже есть клон репозитория с которым вы работаете, делаете pull и смотрите что там какая то фигня накоммитчена от разработчиков.
Выбираем нужный бранч(ветку), у меня она master
git checkout master
делаем откат изменений в репозитории для примера на два коммита назад
git reset —hard HEAD~2
Можно сделать до какого то определенного коммита по хешу
git reset —hard HEAD hash
Хеш можно взять в вебинтерфейсе гитхаба.
Далее делаем принудительный коммит в основной репо на гитхабе
git push -f origin master
без -f будет ругаться что у вас версия младше чем в гитхабе и вам надо сделать pull

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reverting a commit in GitHub Desktop

You can use GitHub Desktop to revert a specific commit to remove its changes from your branch.

When you revert to a previous commit, the revert is also a commit. The original commit also remains in the repository’s history.

Tip: When you revert multiple commits, it’s best to revert in order from newest to oldest. If you revert commits in a different order, you may see merge conflicts.

Screenshot of the

  1. In the left sidebar, click History.

Screenshot of a list of commits in the

Right-click the commit you want to revert and click Revert Changes in Commit.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *