Skip to content

Instantly share code, notes, and snippets.

@asynchroza
Last active September 24, 2025 19:38
Show Gist options
  • Select an option

  • Save asynchroza/7094aba3853a05220d55043dc352074c to your computer and use it in GitHub Desktop.

Select an option

Save asynchroza/7094aba3853a05220d55043dc352074c to your computer and use it in GitHub Desktop.

Revisions

  1. asynchroza revised this gist Sep 24, 2025. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions git.md
    Original file line number Diff line number Diff line change
    @@ -14,4 +14,10 @@ git rebase --onto <target> <current-base> <your-branch>

    ```bash
    git checkout <other-branch-name> -- path/to/your/folder
    ```

    ## Show all commits that touched a specific file

    ```bash
    git log -L <start>,<end>:<file> # git log -L 40,43:app.js
    ```
  2. asynchroza revised this gist Mar 22, 2025. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions git.md
    Original file line number Diff line number Diff line change
    @@ -8,4 +8,10 @@ git branch -m <old-name> <new-name>

    ```bash
    git rebase --onto <target> <current-base> <your-branch>
    ```

    ## Checkout (add) a file/folder from a different branch

    ```bash
    git checkout <other-branch-name> -- path/to/your/folder
    ```
  3. asynchroza created this gist Mar 22, 2025.
    11 changes: 11 additions & 0 deletions git.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    ## Rename a branch

    ```bash
    git branch -m <old-name> <new-name>
    ```

    ## Change base branch

    ```bash
    git rebase --onto <target> <current-base> <your-branch>
    ```