Get inside the folder that contains the repo and cast:
git init
Create a gitignore file inside .git in case something has to stay behind
vim .git/gitignore
Create a remote for chrome and set it as default:
git remote add chrome git@chrome:/home/git/new_one
git config branch.master.remote chrome
# questa non dovrebbe servire
git config branch.master.merge refs/heads/master
#per aggiungere un pull a un locale
git branch --set-upstream-to=kim/master master
git remote -v
git remote show kim
Publish the whole thing on chrome:
git push --all git@chrome:/home/git/siti/new_one
fatal: protocol error: expected old/new/ref, got ‘shallow ...
git fetch –unshallow
to clone the new repo cast:
git clone git@chrome:/home/git/siti/new_one
git clone --depth 1 git@chrome:/home/git/siti/new_one
Aggiungere dentro al .git il file:
touch git-daemon-export-ok
Per renderlo disponibile sia al Demone git che a git web:
cd /var/cache/git/
ln -s /home/git/garage/ ./
Come tool per vedere i diff installare kompare , git difftool per lanciarlo.
Come UI generale: git-cola
Esterni: gitkraken: https://www.gitkraken.com/download
apt-get install libgnome-keyring0
# aggiungere al precedente commit
git commit --amend
# show the tre
git log --oneline --decorate --graph --all
# create
git branch -b hotfix
# delete
git branch -d hotfix
# eliminare sul server
git push origin --delete temp_branch
# non ancora merged
git branch --no-merged
# Seguire un branch presente sul remoto
# il riferimento e' visibile in git remote
git checkout -b dev origin/dev
# uguale a
git checkout --track origin/dev
git checkout dev
A
git branch -vv // vedere dove tirano e come sono messi
git fetch --all; git branch -vv
# Merge just one file from an other branch
git checkout --patch other_branch file
# Se il file non esiste nel branch di destinazione:
touch file
git add .
git checkout --patch other_branch file
Si usa per aggiornare ad es. un branch di sviluppo a master in modo da poter proporre un merge lineare da master al proprio branch:
git checkout experiment
git rebase master
Dopodiche’ master potra’ fare un merge di experiment senza troppi casini.
# go back one commit
git reset --hard HEAD^
# go back 3 commit
git reset --hard HEAD~3
# go back one commit for a file
git reset --hard HEAD^ file_name
A