Version 10 (modified by root, at 2018-04-11T05:28:50Z) (diff) |
---|
заметки о git
инициализация репозитория
начиная с сервера
- на сервере: git init --bare project.git;
- на клиенте: git clone server.name.tld:repo/git/project.git project;
- копируем содержимое исходников в директорию project и выполняем
git add . git commit -a -m "inital release" git push origin master
начиная с клиента
cd project git init git add . git commit -a -m "inital release" git remote add origin server.name.tld:repo/git/project.git git push origin master
синхронизация всех веток в bare репозиториях
git clone --bare url local.git cd local.git git config --add remote.origin.fetch '+refs/*:refs/*' git fetch
pull all branches to local
git branch -a | sed -n \"/\\/HEAD /d; /\\/master$/d; /remotes/p;\" | xargs -L1 git checkout -t"
pull single branch to local
git checkout -t remotes/origin/<branch_name>
drop last n commits
git reset --hard HEAD~n
update branch to master and top up unpushed commits
- git pull --rebase origin master - in not pushed branch with local only commits. if something already pushed to remote it will desynchronize local and remote sides. in this case use:
- git merge master - merge master commits to selected branch
edit, reword, squash, fixup, drop last n commits
git rebase -i HEAD~n
grep commit contents
git log -p --all -G clean_empty_state