Created
October 5, 2018 09:15
-
-
Save Martinnord/371fbadcbbaff6446d81276e476f4ce2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Git: | |
radera fil i repo: | |
git rm path/fil | |
git add -u (bara dem filer som redan traskas) | |
git add . alla ändringar | |
git add -u | |
git reset | |
git stash drop | |
radera local branch: | |
git branch -d the_local_branch (-D forcear) | |
commit all -some file: | |
https://stackoverflow.com/questions/4475457/add-all-files-to-a-commit-except-a-single-file | |
git add -u | |
git reset -- main/dontcheckmein.txt | |
ändra commit message: | |
git commit --amend | |
(om har pustat innan, git push --force) | |
multipla ssh: | |
This is probably the most straightforward approach exploiting SSH’s capability of aliasing hostnames and allowing you to use distinct configuration per host (or aliased host). | |
Create a file ~/.ssh/config if you do not already have it and place the following configuration in it: | |
# account for the foo repo | |
Host github.com-foo | |
HostName github.com | |
User inadarei | |
IdentitiesOnly yes | |
IdentityFile ~/.ssh/id_rsa.github.inadarei.foo | |
# account for the bar repo | |
Host github.com-bar | |
HostName github.com | |
User inadarei | |
IdentitiesOnly yes | |
IdentityFile ~/.ssh/id_rsa.github.inadarei.bar | |
Basically you are telling SSH (and correspondingly Git, when it uses SSH for repo access) to create multiple host aliases for the same hostname of github.com and that each alias should use distinct configurations. Please note the “IdentitiesOnly yes” directive. This config line is very important to make sure that SSH does actually use the identity file you indicate. Otherwise your configuration may be overridden by an SSH agent or other things on the system. | |
IMPORTANT: When you check out a repository with this approach you cannot use the actual Git URL such as: [email protected]:inadarei/foo.git. Instead, you have to edit that URL to use the aliased hostname. For instance, the repo URL for the foo repository will be: [email protected]:inadarei/foo.git. Please note the github.com-foo used as the hostname. | |
If you have an existing local checkout you should alter the URL of the remote by either: | |
* issuing a git command such as: | |
git remote set-url origin [email protected]:inadarei/foo.git | |
sluta tracka fil: | |
git rm --cached <file> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment