Andrew Mercer
on this page

    Merge a branch with main

    This is after you've created a new branch, made changes, checked them in and pushed them.

    git checkout main
    git merge [ branch_name ]
    git add .
    git commit
    git push
    

    Inject credentials into git clone command

    # ~/.gitconfig
    
    [url "https://[ username ]:[ git_token ]@git.domain.tld"]
        insteadOf = https://git.domain.tld
    

    Revert a git pull

    • https://www.warp.dev/terminus/git-undo-pull

    Basically:

    git reflog
    git reset --hard [ commit_hash ]
    

    .gitignore doesn't ignore a directory

    It was likely a directory that had been checked in the past.

    git rm -r --cached [ cached_dir ]
    

    Check what git will add, commit and push

    git add --dry-run .
    

    Delete all .files directories from git

    find . -type d -name '.files' -print0 | xargs -0 -I{} git rm -r --cached "{}"