Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save xto3na/40c7770410226d3201e6 to your computer and use it in GitHub Desktop.
Save xto3na/40c7770410226d3201e6 to your computer and use it in GitHub Desktop.
Git. Создание, удаление удаленной и локальной веток
Надо добавить удаленную ветку, чтобы она синхронизировалась через pull/push.
Сначала надо создать удаленную ветку:
git push origin origin:refs/heads/new_branch_name
Стянуть ее
git pull origin
Посмотреть появилась ли в списке удаленных веток:
git branch -r
Создать локальную ветку и закрепить ее за удаленной
git checkout --track -b new_branch_name origin/new_branch_name
Удалить удаленную ветку можно так
git push origin :heads/new_branch_name
Локальная ветка автоматически создается, когда делаем
git checkout new_branch_name
Слить локальную ветку с удаленной можно так:
git checkout master
git merge new_branch_name
Удалить локальную ветку:
git branch -d new_branch_name
Полезные ссылки:
Про Git на пальцах (для переходящих с SVN) - http://habrahabr.ru/post/68341/
Pro git - http://git-scm.com/book/ru/
Git How To - http://githowto.com/ru/
Магия Git - http://diseaz.github.io/gitmagic/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment