Navigation
Related:
Themes:
Cheatsheet on git-tower
Nice visualisation of git commands: dev.to
See filenames per commit:
git log --name-only
Last commit only:
git log -1 --name-only
To stage All:
git add -A
To stage new and modified, without deleted:
git add .
To stage modified and deleted, without new
git add -u
Ref: Stackoverflow
Setting your branch to exactly match the remote branch can be done in two steps:
git fetch origin
git reset --hard origin/master
from one branch to another:
git push --force remote local-branch:remote-branch
With
alias pom="git push origin master"
alias ph="git push heroku master"
(etc)
quick wins can be made in typing.
git commit <(file)path> -m "message"
We have an alias: alias gcm="git commit . -m", such that:
gcm "hoi"
commits everything staged and the only thing you have to do is typing your message. I find it handy when committing often. Works nicely with push-aliases.
$ git commit -m "Something terribly misguided" (1)
$ git reset HEAD~ (2)
<< edit files as necessary >> (3)
$ git add ... (4)
$ git commit -c ORIG_HEAD (5)
1: This is what you want to undo
2: This leaves your working tree (the state of your files on disk) unchanged but undoes the commit and leaves the changes you committed unstaged (so they'll appear as "Changes not staged for commit" in git status and you'll need to add them again before committing). If you only want to add more changes to the previous commit, or change the commit message1, you could use git reset --soft HEAD~ instead, which is like git reset HEAD~ but leaves your existing changes staged.
3: Make corrections to working tree files.
4: git add anything that you want to include in your new commit.
5: Commit the changes, reusing the old commit message. reset copied the old head to .git/ORIG_HEAD; commit with -c ORIG_HEAD will open an editor, which initially contains the log message from the old commit and allows you to edit it. If you do not need to edit the message, you could use the -C option.
REF: Stackoverflow
(https://github.com/settings/keys)[https://github.com/settings/keys]
check:
ls -al ~/.ssh
if empty, then generate, add to agent and display (to copy into github key setting (see link):
ssh-keygen -t rsa -b 4096 -C "yourmail@example.com"
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub