Тэги
Удаление старого тэга
git tag -d 0.17.0
git push origin :0.17.0
Создание нового тэга
git checkout master
git tag 0.17.0 -m 0.17.0
git push –tags
Клонирование с помощью другого ключа
git clone [email protected]:something.git
git clone git@gitlab_2:something.git
code ~/.ssh/config
Host gitlab.com
HostName gitlab.com
IdentityFile ~/.ssh/id_rsa
User Username_1
Host gitlab_2
HostName gitlab.com
IdentityFile ~/.ssh/id_rsa_2
User Username_2
Клонирование репозитория и смена адреса
git clone ssh://something.git
git remote set-url origin ssh://something_2.git
git checkout master
VS Code как редактор по-умолчанию
git config –global core.editor “code –wait”
export EDITOR=‘code –wait’
Если ничерта не работает
git config core.filemode false
Сброс ветки к состоянию как в репозитории
git fetch –all
git reset –hard origin/dev
Пуш в другую ветку
git checkout -b newbranch
git push -u origin newbranch
Догнать ветку
git merge master
git pull –rebase origin master
Если сломался upstream
git branch –set-upstream-to origin/branch
git push –set-upstream origin branch
Склеивание коммитов
https://htmlacademy.ru/blog/useful/git/how-to-squash-commits-and-why-it-is-needed
git rebase -i HEAD~2
squash
fixup
git log
git push –force
Разделение коммитов
- Checkout the branch that you want to modify (e.g. pj/feature)
- Start an interactive rebase which includes your commit.
- At a minimum, git rebase -i commit^ will start the rebase at the commit you want to split
- You can also rebase the whole branch, which I usually do to split all target commits in one go
- Mark the commit(s) that you want to split with edit
- When git presents the commit that you want to split:
- Reset state to the previous commit using git reset HEAD^
- Use git add to carefully and incrementally add changes to the index
- Run git commit when you have a set of atomic changes that you are ready to commit
- Repeat the git add and git commit process until you have processed each set of changes represented by the commit
- Run git rebase –continue to resume or finish the rebase
git fetch
git checkout branch
git merge origin/master
git checkout -b new-branch
git reset –hard origin/master
git merge –squash branch
Если необходимо сменить почту на коммитах
https://www.git-tower.com/learn/git/faq/change-author-name-email/