• saigot@lemmy.ca
    link
    fedilink
    arrow-up
    24
    ·
    7 months ago

    I like this graphic, some of my favourites:

    git log --oneline is super useful for getting just a list of title of commits and nothing else

    git bisect is a little known but extremely useful git archaeology command that automates binary searching for a regression.

    • fmstrat@lemmy.nowsci.com
      link
      fedilink
      English
      arrow-up
      7
      ·
      7 months ago

      You’re gonna love this then:

      alias gl='git log --graph --abbrev-commit --no-decorate --date=format:'\''%Y-%m-%d %H:%M:%S'\'' --format=format:'\''%C(8)%>|(16)%h  %C(7)%ad  %C(8)%<(16,trunc)%an  %C(auto)%d %>|(1)%s'\'' --all'
      

      I have a whole rc file full of shortcuts like this for Git and Docker.

      • lars@lemmy.sdf.org
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        7 months ago

        Nobody loves pedantic escaped single quoting more than I.

        Except for you wow.

        Show us the rc.

    • caseyweederman@lemmy.ca
      link
      fedilink
      arrow-up
      7
      ·
      7 months ago

      I just learned git bisect from https://ohmygit.org/! You run it, then checkout other commits all over the project, and mark them with git bisect good or git bisect bad. Then it paints all commits that led to the good one as good, and all the ones after the bad one as bad, so you just keep narrowing your window by playing checkout Jezzball until there’s only one commit left: the one that introduced the bad state.

        • caseyweederman@lemmy.ca
          link
          fedilink
          arrow-up
          1
          ·
          7 months ago

          Yeah but I didn’t know that term until I looked it up. Also OhMyGit didn’t cover using tests and automating it.

          • huginn
            link
            fedilink
            arrow-up
            2
            ·
            7 months ago

            Definitely a useful tool and one you should’ve learned in a college algorithms course. Binary search backs a lot of high performance data structures