= заметки о `git` == инициализация репозитория === начиная с сервера * на сервере: `git init --bare project.git`; * на клиенте: `git clone server.name.tld:repo/git/project.git project`; * копируем содержимое исходников в директорию `project` и выполняем {{{#!bash git add . git commit -a -m "inital release" git push origin master }}} === начиная с клиента {{{#!bash 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 }}} [[br]] == синхронизация всех веток в bare репозиториях {{{#!bash git clone --bare url local.git cd local.git git config --add remote.origin.fetch '+refs/*:refs/*' git fetch }}} == pull all branches to local {{{#!bash 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/` == 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`