recover previous version of project using git COLA

狂风中的少年 提交于 2021-02-19 07:06:01

问题


how to get the previous version of project once it is committed using GIT COLA GUI.

I have a C++ file in the project. i created that file on 13th feb. i made changes to that file on 14th feb and saved it. now i want to get back to version dat was saved on 13th feb. so how to do this using GIT COLA. this project is in GIT repository.


回答1:


Use the "View > DAG..." window to display all of the commits in the entire project. This window is referred to as the "DAG" window. You can also launch the DAG standalone by running "git dag" or "git cola dag".

From the DAG window you can right-click on any commit and "Reset" either your branch and/or worktree to any previous commit.

You can also use the "Grab File..." context menu action to grab an older version of any file, from any commit.




回答2:


I don't seem to find that option directly through Git Cola.

Don't forget that, in command line, it is very easy to checkout by date:

git checkout master@{1 days ago} -- /path/to/file
git checkout master@{2013-02-13 01:00} -- /path/to/file

If you are talking just about the previous revision

git checkout HEAD^ -- /path/to/file

I should mention, as detailed in this blog post, that @{a date} refspec won't always work:

(won't always work) because it uses the reflog (which expires after some time).

The trick (as found on Nabble) is to lookup the revision on a certain date and check out that revision. This can be done in a single command:

git checkout `git rev-list -n 1 --before="2013-02-13 23:59" master` -- /path/to/file


来源:https://stackoverflow.com/questions/14876395/recover-previous-version-of-project-using-git-cola

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!