{ claus.conrad }

Git

FAQ

Remote: error: failed to lock refs/heads/…

Ignoring files without adding them to .gitignore

To ignore untracked files, you have a file in your git folder called .git/info/exclude. This file is your own gitignore inside your local git folder, which means is not going to be committed or shared with anyone else. You can basically edit this file and stop tracking any (untracked) file.

My basic configuration for a new device

git config --global user.name "Claus Conrad"
git config --global user.email 584491+cconrad@users.noreply.github.com
git config --global core.autocrlf false

Get list of accessible repositories

ssh git@git.bekey.dk info
  • Source: [Serhii Ch.](…/Serhii Cherednychenko/)

Pull and merge remote branch “origin/main” into current

git pull origin main

Rollback to previous commit

Revert your repo to an older commit and preserve all intervening work:

git checkout 307a5cd        # check out the commit that you want to reset to 
git checkout -b fixy        # create a branch named fixy to do the work
git merge -s ours master    # merge master's history without changing any files
git checkout master         # switch back to master
git merge fixy              # and merge in the fixed branch
git push                    # done, no need to force push!

Done! Replace 307a5cd with whatever commit you want in your repo.

Source: Stack Overflow

Resources

Alternatives