git and SVN - Davz33/tutorials GitHub Wiki
This is needed to push and pull from a git repo using ssh. Https pushes and pulls have fallen in disuse and are not supported by GitHub from terminal shells anymore.
ssh-keygen -t ed25519 -C "<your-email>"
Let's say the generate file's path are ~/.ssh/key
and ~/.ssh/key.pub
.
cat ~/.ssh/key.pub
, then go to https://github.com/settings/keys and add a new key with the content in output.
Now, to use git's pull & push commands on private repos from the terminal, you can run:
'eval $("ssh-agent") && ssh-add ~/.ssh/id_rsa'
To make it quicker, you can also add this line to the end of ~/.bash_aliases
or your ~/.zshrc
:
alias conn-gh='eval $("ssh-agent") && ssh-add ~/.ssh/id_rsa'
which allows one to run the conn-gh
command directly.
-
git stash
: all files except untracked and .gitignored ones -
git stash --include-untracked
: includes untracked files -
git stash --all
: untracked and .gitignored too -
git stash –patch
: interactive mode; you go one by one and decide what to stash
It's preferable to add a stash description that will help you remember the reason for stashing and the content therein, once you'll come back to it:
git stash save <various flags> <descr>
Now you can list your stashes:
git stash list
And check out a new branch. One you'll come back to it:
git stash list
: take note of the heading identifier of the stash you want to restore.
git stash pop stash@{<id>}