Questions tagged [git-history-graph]

Git represents history as a directed-acyclic-graph (DAG) of commits, where each commit has at least one parent commit (the exception to this are root commits).

Git represents history as a directed-acyclic-graph (DAG) of commits, where each commit has at least one parent commit (the exception to this are root commits).

There are various tools that allow you to inspect this graph, including:

  • git log
  • git merge-base
33 questions
1635
votes
10 answers

How can I view an old version of a file with Git?

Is there a command in Git to see (either dumped to stdout, or in $PAGER or $EDITOR) a particular version of a particular file?
mike
  • 40,704
  • 43
  • 97
  • 111
213
votes
9 answers

How can I view the Git history in Visual Studio Code?

I can execute various Git commands from Visual Studio Code, however I couldn't find a way to visualize the history.
rlesias
  • 2,530
  • 3
  • 11
  • 19
69
votes
5 answers

How can I tell if one commit is an ancestor of another commit (or vice-versa)?

Git is a DAG of snapshots, with each node on the graph representing a commit. Each commit can have 'n' parent commits. Given any two commits, is there a single, concise way to discern the "order" of these two in the DAG. git rev-list seems to be…
Chris Cleeland
  • 4,307
  • 2
  • 23
  • 27
5
votes
1 answer

Git log for only part of a file?

https://stackoverflow.com/a/5493663/1172541 explains how you can do a git log command for a file. Is there a way to track how part of a file changed with git log or other git command? (Of course, this would definitely strains git's diff engines, as…
PyRulez
  • 9,505
  • 9
  • 37
  • 82
5
votes
2 answers

Git merge only the final result of a development branch

If a Git repository structure looks like this: master: A-C dev: \B-D-E is it possible to merge the development branch into master so that only one commit is added to master, containing all of the changes found in all of the commits in the…
Bobulous
  • 12,241
  • 4
  • 36
  • 63
4
votes
1 answer

Change the root commit parent to point to another commit (connecting two independent git repositories)

I have a project that has more than 3 years of history in the svn repository. It was migrated to git, but the guy who did this, just take the last version and throw out all these 3 years of history. Now the project has the last 3-4 months of history…
lmcarreiro
  • 4,176
  • 1
  • 28
  • 53
4
votes
2 answers

How to find whether a given commit is on the first-parent chain of a branch

I'm trying to script a way to tell if a given commit is on the first-parent chain of a given branch. So, for example, merge-base won't fly, as the commit might have been merged in. I want to know whether the exact commit was ever the tip of the…
Steve Benz
  • 202
  • 2
  • 8
4
votes
5 answers

How do I see a commit's path through git history, or "how it got in the current branch"?

I'm looking in the commit history using gitk and git log and I'm trying to see how a specific commit arrived in a certain branch. I can see the commits in the history, so I know they are there. What I want to understand is how they got merged (they…
Ehryk
  • 1,781
  • 2
  • 24
  • 46
3
votes
2 answers

Git: merge two repositories one over the other

I have a repository A (the original one) having its full set of commits. At a point in time it was decided that repository A wouldn't be used anymore and a new clean repository B was created from scratch putting all repo A's contents using copy +…
Ivan Caravanio
  • 497
  • 1
  • 6
  • 19
2
votes
1 answer

git: what is difference between tilda (~) and caret (^)

Below is the git output for show-rev $ git name-rev --all 2651919f941c11581c794b40aadb2028c4f52ab4 joincolumn_issue 2617f2a1410ce0ec8ea268bbb073008b73490e78 master~2 292def505dd3cdbfd9ac974396775683b5f4c288…
samshers
  • 1,269
  • 1
  • 18
  • 39
2
votes
3 answers

How to delete an specific old commit without deleting the changes in the code (i.e change the git story basically)

I have a repository, it's only mine, so there's no problem on breaking anything. Also there's only one branch, I think that makes things easier. Let's say I have this 7 commits: A -> B -> C -> D -> E -> F -> G And I want to delete commits C and D A…
1
vote
1 answer

Determine parent branch/commit from git history

I've got following history in git: * 02e085a (master) readme update | * 1d940da (HEAD -> b1) search.py | | * 7aaa12d (b2) file2 | |/ | * 7be9db9 file1 |/ * 22601c0 initial commit Now I'm on b2 and I would like to get the point, where b2 branched…
ST Renegade
  • 159
  • 9
1
vote
0 answers

visual studio code built-in story for reviewing git commit history and doing diffs of its contents

In this SO question details are provided on use of out of box vscode "Timeline view" experience is covered as a way to look at commit history and diffs from a file scope perspective. Does out of box vscode support exist for gui review of a commit…
myusrn
  • 718
  • 9
  • 23
1
vote
1 answer

Add all commits from GitLab merge request to Upsource review

I have GitLab MR and I want to review these changes in Upsource (I want to merge the changes from feature to rc). feature contains commits 2, 4, 6, 8. But when I clicked Create branch review on my MR branch, not all committs from MR were exported to…
beta-tank
  • 380
  • 1
  • 4
  • 16
1
vote
1 answer

How to rewrite the master branch history to other Repository master branch

Is there any way or any tool or commands to re write the history of master or some A branch from some commit number to newly created master branch of NEW REPOSITORY with master branch with 0 commits or no history. In such a way that : All the…
Shan Khan
  • 7,576
  • 11
  • 52
  • 95
1
2 3