git-show

git - Is git show safe to use on binary files when the output is redirected to a file?

雨燕双飞 提交于 2019-12-12 16:22:11
问题 I read that it's possible to retrieve a single file from a specific revision in Git, as answered in this SO question: How to retrieve a single file from specific revision in Git? So I want to know if it's safe to do that with binary files. I have some binary files in use and I don't want to check them out, really what I want to do is copy them out from a specific revision. I tried this: git show HEAD~1:database.db > copy-of-database-from-mmddyy.db That seems to work, as in the output is an

Git show whole file changes

假如想象 提交于 2019-12-10 10:14:36
问题 Is there a way to get the git show command to show the whole contents of a file when viewing a commit? For example: if it currently show something like foo.cpp +++ int main() { +++ std::cout << "HELLO" << std::endl; +++ } I would want the output to say: foo.cpp #include <stdio> //assuming this was from an earlier commit +++ int main() { +++ std::cout << "HELLO" << std::endl; +++ } Is there a simple way to do this? 回答1: This is kind of a hack, but git show (like git diff ) has the -U option

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

橙三吉。 提交于 2019-12-07 15:34:40
问题 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 following command, git show -w <commit-id> is not showing me full context. Any suggestion? 回答1: git-show comes with the following flag -U<n>, --unified=<n> Generate diffs with <n> lines of context instead of the usual three. Implies -p. See the git-show man page for more details. By specifying a

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

萝らか妹 提交于 2019-12-05 20:02:28
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 following command, git show -w <commit-id> is not showing me full context. Any suggestion? git-show comes with the following flag -U<n>, --unified=<n> Generate diffs with <n> lines of context instead of the usual three. Implies -p. See the git-show man page for more details. By specifying a large enough <n> , e.g. git show -U1000 <object> you will get full context. Example Clone some repository for

Difference between `git stash show -p stash@{N}` and `git show stash@{N}`?

ε祈祈猫儿з 提交于 2019-12-03 09:24:51
问题 I thought they should be basically the same, but when I tried $ git stash show -p stash@{N} and $ git show stash@{N} the latter shows some additional commit information, but the actual diff was much, much shorter. (The former shows about a dozen files, but the latter only one.) So, what exactly is the difference between the two and why are they different? Can I also rely on things like git diff stash@{M} stash@{N} to be correct? 回答1: Stash bags The thing saved by git stash is what I have

git log -p vs. git show vs. git diff

余生颓废 提交于 2019-12-03 04:19:32
问题 How are the commands git log -p , git show , and git diff related and why would one be used over another? Given a repo with the following 4 commits: commitd - last commit commitc commitb coomita - initial commit What are the differences between the following git commands?: git log -p commitb commitd git show commitb commitd git diff commitb commitd git log -p commitd commitb git show commitd commitb git diff commitd commitb git log -p commitb..commitd git show commitb..commitd git diff

Difference between `git stash show -p stash@{N}` and `git show stash@{N}`?

余生长醉 提交于 2019-12-02 23:43:27
I thought they should be basically the same, but when I tried $ git stash show -p stash@{N} and $ git show stash@{N} the latter shows some additional commit information, but the actual diff was much, much shorter. (The former shows about a dozen files, but the latter only one.) So, what exactly is the difference between the two and why are they different? Can I also rely on things like git diff stash@{M} stash@{N} to be correct? torek Stash bags The thing saved by git stash is what I have taken to calling a "stash bag" . It consists of two 1 separate commits: the "index" commit (the staging

How to get git to show commits in a specified date range for author date?

╄→гoц情女王★ 提交于 2019-11-28 07:56:48
Apparently this : git log --all --after="<date> 00:00" --before="<date> 23:59" --author="<author>" filters commits based on the committer date . How can I make it show commits for a specified author date range ? You can't—at least, not in Git alone. (Reminder to others visiting this question: it's not about viewing the author date, it's about selecting commits by the author date, a la --since / --after and --until / --before . These selectors use the committer date, not the author date. Consider as an extreme example a commit made "now", so that its committer date is in the 2000s, but

How to get git to show commits in a specified date range for author date?

自古美人都是妖i 提交于 2019-11-27 02:01:55
问题 Apparently this: git log --all --after="<date> 00:00" --before="<date> 23:59" --author="<author>" filters commits based on the committer date . How can I make it show commits for a specified author date range ? 回答1: You can't—at least, not in Git alone. (Reminder to others visiting this question: it's not about viewing the author date, it's about selecting commits by the author date, a la --since / --after and --until / --before . These selectors use the committer date, not the author date.

Git - how to list ALL objects in the database

a 夏天 提交于 2019-11-26 08:59:23
问题 Is there a better way of getting a raw list of SHA1s for ALL objects in a repository than doing ls .git/objects/??/\\* and cat .git/objects/pack/*.idx | git show-index ? I know about git rev-list --all but that only lists commit objects that are referenced by .git/refs, and I\'m looking for everything including unreferenced objects that are created by git-hash-object, git-mktree etc. 回答1: Edit: Aristotle posted an even better answer, which should be marked as correct. Edit: the script