Skip to content

Instantly share code, notes, and snippets.

@simone-sanfratello
Last active March 2, 2024 08:24
Show Gist options
  • Select an option

  • Save simone-sanfratello/07aadfe8d8c3eb6acce1f8a6cfde699f to your computer and use it in GitHub Desktop.

Select an option

Save simone-sanfratello/07aadfe8d8c3eb6acce1f8a6cfde699f to your computer and use it in GitHub Desktop.

Revisions

  1. simone-sanfratello revised this gist Mar 2, 2024. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion TIPS.md
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,12 @@

    ### git

    - add origin named "upstream" to the forked repo

    ```bash
    git remote add upstream https://github.com/OWNER/REPOSITORY.git
    ```

    - push the current branch, which is new

    ```bash
    @@ -19,7 +25,7 @@ git fetch origin && git checkout main && git merge upstream/main
    - clone a repo using a specific auth key

    ```
    git clone [email protected]:owner/repo.git --config core.sshCommand="ssh -i ~/.ssh/that-key"
    git clone [email protected]:OWNER/REPOSITORY.git --config core.sshCommand="ssh -i ~/.ssh/that-key"
    ```

    ### docker
  2. simone-sanfratello revised this gist Mar 2, 2024. 1 changed file with 20 additions and 4 deletions.
    24 changes: 20 additions & 4 deletions TIPS.md
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,31 @@
    # Tips & Tricks collection

    # Command aliases
    ## Command aliases

    git - push the current branch, which is new
    ### git

    ```
    - push the current branch, which is new

    ```bash
    alias git-push-new-branch='git push --set-upstream origin $(git branch --show-current)'
    ```

    docker - stop all running containers
    - sync forked repo from origin

    ```bash
    git fetch origin && git checkout main && git merge upstream/main
    ```

    - clone a repo using a specific auth key

    ```
    git clone [email protected]:owner/repo.git --config core.sshCommand="ssh -i ~/.ssh/that-key"
    ```

    ### docker

    - stop all running containers

    ```bash
    alias docker-stop-all='docker stop $(docker ps -q)'
    ```
  3. simone-sanfratello created this gist Mar 2, 2024.
    15 changes: 15 additions & 0 deletions TIPS.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    # Tips & Tricks collection

    # Command aliases

    git - push the current branch, which is new

    ```
    alias git-push-new-branch='git push --set-upstream origin $(git branch --show-current)'
    ```

    docker - stop all running containers

    ```
    alias docker-stop-all='docker stop $(docker ps -q)'
    ```