Equivalent scrapbook

…scrap on Git

how to remove commit from github

git push -f origin HEAD^:master     # last commit
git push -f origin HEAD^^:master    # last two commit
git push -f origin HEAD^^^:master   # last three commit

That should "undo" the push.

http://stackoverflow.com/questions/448919/how-can-i-remove-a-commit-on-github

rebase to master subranch of branch

git rebase --onto master jobs tlds

git repository on usb

http://blog.costan.us/2009/02/synchronizing-git-repositories-without.html

    mkdir /path/to/usb/stick/repository.git
    git clone --local --bare . /path/to/usb/stick/repository.git
    git remote add usb file:///path/to/usb/stick/repository.git
    git push usb master

    git clone file:///path/to/usb/stick/repository.git

if you get error via cloning

    Invalid cross-device link

add also option

    --no-hardlinks

"You can use the git clone --no-hardlinks option to tell git to take a copy of the files rather than attempt to symlink over to the mounted USB drive." by WiredBob

how to setup serverside project

http://tumblr.intranation.com/post/766290565/how-set-up-your-own-private-git-server-linux
http://www.nextgengeek.com/2011/01/22/how-to-configure-a-git-server-on-ubuntu-10-10/

on server

  • install git core on server side

    sudo apt-get update
    sudo apt-get install git-core

  • edit / paste clients public key to server file /home/anyuser/.ssh/authorized_keys

  • inicialize new repo on server side

mkdir ~/repositories/my_project.git
cd !$
git --bare init

on client (new projekt)

cd ~/my/project_folder
git init
git remote add origin anyuser@somethisg.com:/repositories/my_project.git
git add .
git commit -m "foo"
git push origin master

on client (existing projekt)

  git clone nyuser@somethisg.com:/repositories/my_project.git

fetch remote origin branches ond prepare them so ruby can process it

git ls-remote --heads | awk '{print $2}'

gitignore file that has been allreaddy tracked

so put your file name to .gitignore

somefolder/somefile

than do

git rm -r --cached somefolder/somefile
git add .
git commit -m "removing tracking "

there is also possibility to do

git rm -r --cached .

that will remove all files from index, and you can add them again.

reset to previous state (realy hard)

f.e. if you merge and you have conflict, you will restart to state before merge

git reset --hard

How to delete files from repo

you git added and commited file, now you deleted it with rm. But if you do git s it's still in repository

    delete:  app/view/some/file

way to rm that

git co app/view/some/file
git rm app/view/somefile
gin commit

creating aliases

edit @$HOME/.gitconfig@

[alias]
  cc = commit -m 'Just simple content'
  s = status
  ph = push heroku master??