git essentials

last updated: 21 Aug 2019

git config

unique local config for a repo:

three layers of git username and useremail can be set (more with the right config settings)

git config --list

this most likely is the global setting, especially if you haven’t set these to a local value before. set them specifically for the local repository using

git config --local user.name "repo-specific-user-name"
git config --local user.email "repo-specific-login-email"

unset a set value - example to remove a local user.email

git config --local --unset user.email

view git config file:

navigate to app’s root directory and review current config settings

git config --list

rebasing

git checkout --orphan newBranch
git add -A  # Add all files and commit them
git commit
git branch -D master  # Deletes the master branch
git branch -m master  # Rename the current branch to master
git push -f origin master  # Force push master branch to github
git gc --aggressive --prune=all     # remove the old files

change remote origin URL

$ git remote set-url origin https://github.com/USERNAME/REPOSITORY.git

setting local repo to use http path to push

git config --global credential.useHttpPath true

force push master to remote origin

git push origin master -f

references


created: 15 Aug 2019
today's track: Can't Get Enough (Unplugged) by BRKLYN feat. Mariah McManus