question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to display branch label on all commits?

See original GitHub issue

I have this:

<div id="gitgraph"></div>
 const graphOptions ={
 orientation:'vertical-reverse'
 }
    const graphContainer = document.getElementById("gitgraph");

    const gitgraph = GitgraphJS.createGitgraph(graphContainer,graphOptions);

    const master = gitgraph.branch("master");
    master.commit("Initial commit");

    const develop = gitgraph.branch("develop");
    develop.commit("Add TypeScript");

    const aFeature = gitgraph.branch("a-feature");
    aFeature
      .commit("Make it work")
      .commit("Make it right")
      .commit("Make it fast");

    develop.merge(aFeature);
    develop.commit("Prepare v1");

    master.merge(develop).tag("v1.0.0");

gitgraphissue

As you can see branch labels not appearing on all commits, but I want the branch labels on all commits. How to achieve that? Here is the fiddle

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
nicoespeoncommented, Jun 7, 2019

@IsaacHub I’ve got great news: we added an option to do this in version v1.3.0 of @gitgraph/js and v1.4.0 of @gitgraph/react packages.

You can use the following option when you create the graph to activate:

https://github.com/nicoespeon/gitgraph.js/blob/4f85de4702881326520a1efcd11a221835eb9031/packages/stories/src/gitgraph-react/1-basic-usage.stories.tsx#L215

Thanks for your suggestion 👍

1reaction
IsaacHubcommented, May 29, 2019

Yes. We prefer having the branch name on every commit. Because WE NEED IT. You should consider adding a new option to the library in the next patch release or minor release so that we can write something like

 const graphOptions = {
    orientation : 'vertical-reverse',
    branchNameOnEveryCommit : true
 }

By default your library can ship with branchNameOnEveryCommit set to false. Let the user decide the display of branch names while initiating the graph. As simple as that. Make sense?

More configurable usability of a library is the real success.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I show the name of branches on every commit in `git ...
1 Answer 1 · 3. I use something similar, but "%d" only gives labels the tip of each branch. · The one I...
Read more >
git-show-branch Documentation - Git
Shows the commit ancestry graph starting from the commits named with <rev>s or <glob>s (or all refs under refs/heads and/or refs/tags) semi-visually.
Read more >
git continued: Branching and tags - GitHub Pages
Git uses pointers, which are labels for particular commits in the history. ... To see all existing branches, as well as which one...
Read more >
Git Cheat Sheet - GitLab
An overview with reference labels and history graph. One commit per line. $ git log ref.. List commits that are present on the...
Read more >
Log tab | PhpStorm Documentation - JetBrains
tip · The Branches pane is located on the left and shows all local and remote branches. · The Commits pane is located...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found