mathieudutour / scroll-through-time

:hourglass: :tophat: :rabbit2: Two fingers scroll moves through time instead of space
https://xkcd.com/1806/
MIT License
721 stars 54 forks source link

Scroll through git history #3

Open pixelcort opened 7 years ago

pixelcort commented 7 years ago

Currently this scrolls through undo/redo history. In addition, it would be nice to scroll back through git history as well.

mathieudutour commented 7 years ago

Hum that's a difficult feature to conceptualise:

xtrasmal commented 6 years ago

You would need to load the history of all commits, then play them back. This will change all other files in the project as well. Plus you need to stash the current changes or prevent scrolling when there are changes.

Another way would do git log -p myFile and see all changes of the file up to it's creation and get that into the file somehow. Then you do not need to stash anything, because all changes are added.

If you like, apparently, you can keep track of one file as explained here: https://stackoverflow.com/questions/11128434/how-can-i-use-git-to-track-versions-of-a-single-file/13336304#13336304

szhu commented 6 years ago

Actually, Git does provide an API for viewing the contents of files at another revision, without checking them out; the command is git show. [stack overflow]

So to implement the "scroll through git history" feature, you can:

xtrasmal commented 6 years ago

@szhu this will be "read-only"

szhu commented 6 years ago

@xtrasmal can you clarify what you are referring to? I believe both your solution and mine are solutions that only read from the Git API.

ndelangen commented 5 years ago

This sounds cool and possibly lightly useful

BlueCl0wn commented 5 years ago

In Atom there is the "git-time-machine" Package from littlebee which enables a timeline where you can look at your older commits.