Git - paulvi/notes GitHub Wiki

Configer git ll and git lg:

git config --global alias.ll "config --list --local"
git config --global alias.lg "config --list --global"

Check where exactly a property is stored: grep ll .git/config ~/.gitconfig /etc/gitconfig

git config --global alias.changeemail "config user.email [email protected]"

Git and GitHub

GitHub Personal access tokens

visit https://github.com/settings/tokens (Settings -> Personal access tokens -> Personal access tokens)

git clone https://<username>:<githubtoken>@github.com/<username>/<repositoryname>.git

git remote set-url origin https://<token>@github.com/<username>/<repo>

https://stackoverflow.com/questions/68775869/support-for-password-authentication-was-removed-please-use-a-personal-access-to#:~:text=From%20August%2013%2C%202021%2C%20GitHub,a%20PAT%20on%20your%20system.

Git

http://stackoverflow.com/questions/3230074/git-pushing-specific-commit

git push <remotename> <commit SHA>:<remotebranchname> should do the trick, provided already exists on the remote. If it doesn't, use
git push <remotename> <commit SHA>:refs/heads/<remotebranchname>

http://stackoverflow.com/questions/2016901/viewing-unpushed-git-commits

git log origin/master..HEAD

You can also view the diff using the same syntax

git diff origin/master..HEAD

http://stackoverflow.com/questions/1587846/how-do-i-show-the-changes-which-have-been-staged

https://github.com/eclipse/thym/blob/master/CONTRIBUTING.md

http://stackoverflow.com/questions/14075581/git-undo-all-uncommitted-changes

git reset
git checkout .
git clean -fdx

This will unstage all files you might have staged with git add:

git reset

This will revert all local uncommitted changes (should be executed in repo root):

git checkout .

You can also revert uncommitted changes only to particular file or directory:

git checkout [some_dir|file.txt]

Yet another way to revert all uncommitted changes (longer to type, but works from any subdirectory):

git reset --hard HEAD

This will remove all local untracked files, so only git tracked files remain:

git clean -fdx

git using branches

git branch
git checkout -b <branchName>

git commit
git push origin <branchName>

git checkout master
git merge <branchName>
git push origin master

git branch -d <branchName>
git branch -a
git branch -a -vv
git push origin --delete <branchName>

launch notepad++ from command line

set PATH=%PATH%;C:\Program Files (x86)\Notepad++

just start notepad++ filename

⚠️ **GitHub.com Fallback** ⚠️