Linked Questions

2 votes
3 answers
3k views

Git extract commits as separate files [duplicate]

I have a git repo with one file which has new commits added almost daily. I would like to extract copies of the file as it looked at every commit to a new directory. Ideally the files would be date-...
John L. Godlee's user avatar
5 votes
1 answer
471 views

Is there any way to find out what an entire file looked like in a particular commit? [duplicate]

Is there any way to find out what an entire file looked like in a particular commit after applying all changes to it? I know there is a difference between 2 files(what was added and removed) and that'...
Incerteza's user avatar
  • 35.4k
0 votes
1 answer
127 views

Git: How to grep code in history and show original file? [duplicate]

I'm grepping code in git history using the following command: git grep "foo" $(git rev-list --all) It's returning a list where each line begins with a king of hash: ...
DevonDahon's user avatar
  • 8,520
0 votes
0 answers
21 views

get a specific file at special commit url using git cli [duplicate]

Can I get the file url from git command line? For example, In here, https://git.postgresql.org/gitweb/?p=postgresql.git;a=history;f=src/test/regress/sql/alter_table.sql;hb=...
jian's user avatar
  • 5,013
93 votes
9 answers
17k views

Equivalent in git of "hg cat" or "svn cat"

I want to extract a copy of the latest version of a file held in a git repository, and pass it into a script for some processing. With svn or hg, I just use the "cat" command: Print the specified ...
Richard Boulton's user avatar
79 votes
3 answers
46k views

How to get a copy of an older version of a file in a git repository?

I have a version of a .tex file from a number of commits ago that I would like to get a copy of. I have the sha1 hash value for the commit that has the version of that file that I want. I do not want ...
jbranchaud's user avatar
  • 6,127
136 votes
1 answer
110k views

git revert --no-commit without staging

Usually the command git revert automatically creates some commits with commit log messages stating which commits were reverted. To avoid automatic commit there's the option -n (or --no-commit). But ...
lornova's user avatar
  • 7,034
52 votes
4 answers
35k views

how can I list all the different versions of a file, and diff them also?

using git, I want to list all the different revisions of a given file. Then, I want to choose a particular version and compare it when another. How can I do this?
mrblah's user avatar
  • 104k
7 votes
1 answer
29k views

Git show's file path

Let's say I have a git repo for my stuffs inside a directory myapp: myapp /.git /.gitignore /subdirA /subdirB /file1.txt /file2.txt /(and some ...
user740006's user avatar
  • 1,877
5 votes
3 answers
2k views

Does another version control system have a ClearCase-like filesystem access to file versions?

In ClearCase, if I am working on some file X and want to also see its previous version (say version 5), it is available as X@@/main/5. Is something similar available with other (preferably free) ...
Vijay's user avatar
  • 143
5 votes
2 answers
2k views

How can I get "git show" to show diffs with full context?

I am reviewing a very old commit. I want to see the changes a particular commit made but I want to see that in full context, i.e. I want to see whole file and the changes that person had made. The ...
MAG's user avatar
  • 3,127
2 votes
1 answer
3k views

Is that possible to see a file in a specific commit from Github desktop locally than the difference?

In Gitlab/Github, if I use it remotely, I can download a file in a specific commit, by going to the commits and browser the repository at that commit. If I use the Github desktop on windows with the ...
Redzeń's user avatar
  • 23
1 vote
1 answer
1k views

How to recover a overwritten file on doing git pull

I have admin.html file. I modified it. I am working on master. But before committing it, I did git pull. There is admin.html file in BitBucket, and my (changed) admin.html file is overwritten by the ...
raviraja's user avatar
1 vote
1 answer
915 views

Viewing previous versions of a file in git (squashed commits)

What I intend to do is similar to what's written here. I did what the top answer says, however, I realised that I had squashed my commits. This is what my commit history looks like: Date: <...
magikarp's user avatar
  • 460
2 votes
1 answer
232 views

Specific Git file version to specific folder

I have a Git repository and I would like to see how a file looked at a specific commit. So to retrieve all commits of a file, I am using git log [filepath]. With git log, the application retrieves ...
Odrai's user avatar
  • 2,433

15 30 50 per page