This page (revision-22) was last changed on 13-Oct-2021 18:43 by arcoleo

This page was created on 31-Mar-2020 17:25 by arcoleo

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
22 13-Oct-2021 18:43 1 KB arcoleo to previous
21 13-Jul-2021 19:34 1 KB arcoleo to previous | to last

Page References

Incoming links Outgoing links
Git Branch Usage ...nobody

Version management

Difference between version and

At line 1 changed one line
{toc}
[{TableOfContents}]
At line 5 changed one line
!! Squashing Your Branch
!!! Squashing Your Branch
At line 7 changed 5 lines
Checkout your branch
{{{
omz> gco $branch_name
zsh> git checkout $branch_name
|| Description || Zsh || Git
| Checkout branch | {{{gco $branch_name}}} | {{{git checkout $branch_name}}}
| Squash against master | {{{g rbim}}}[1][2] | {{{git rebase -i HEAD~$(git rev-list --count master..);
At line 11 added 5 lines
| Squash against another branch | {{{g rbi $branch_name}}}[3] | {{{git rebase -i HEAD~$(git rev-list --count ${1}..);
}}}
| Force push your branch | {{{ggfl}}} | {{{git push
--force-with-lease
origin $current_branch}}}
At line 14 changed one line
Rebase your branch from master. {{$number_of_commits}} is displayed in GitLab at the top, where it says
{{.gitconfig}} syntax:
At line 16 changed one line
Overview: X, Commits: Y, Pipelines: Z, ...
[#1] {{{rbim = "!f() { git rebase -i HEAD~$(git rev-list --count master..); }; f"}}}
At line 18 changed one line
The number you want is Y.
[#2] {{{rbin}}} if using main instead of master
At line 20 changed 4 lines
{{{
omz> grbi HEAD~5
zsh> git rebase -i HEAD~$number_of_commits
}}}
[#3] {{{rbi = "!f() { git rebase -i HEAD~$(git rev-list --count ${1}..); }; f"}}}
At line 25 changed one line
Force push your branch
!!! Update From Master
At line 27 removed 7 lines
{{{
omz> ggfl
zsh> git push --force-with-lease origin $current_branch
}}}
!! Update From Master
At line 36 changed one line
Checkout master
Assuming you are currently in {{$branch_name}},
At line 38 changed 4 lines
{{{
omz> gcm
zsh> git checkout master
}}}
|| Description || Zsh || Git
| Checkout master | {{{gcm}}} | {{{git checkout master}}}
| Pull | {{{gl}}} | {{{git pull}}}
| Checkout branch | {{{gco @{-1} }}}[3] | {{{git checkout @{-1} }}}
| Rebase from master | {{{grbm}}} | {{{git rebase master}}}
| Handle conflicts, test, etc.
| Force push {{{$current_branch}}} to remote | {{{ggfl}}} | {{{git push
--force-with-lease
origin $current_branch}}}
At line 43 changed one line
Pull
[#3] references the most recent branch, {{{$branch_name}}}
At line 45 changed 4 lines
{{{
omz> gl
zsh> git pull
}}}
!!! Push to Master
At line 50 removed 25 lines
Checkout branch
{{{
omz> gco $branch_name
zsh> git checkout $branch_name
}}}
Rebase from master
{{{
omz> grbm
zsh> git rebase master
}}}
Handle conflicts, test, etc.
Force push \$current_branch to remote.
{{{
omz> ggfl
zsh> git push --force-with-lease origin $current_branch
}}}
!! Push to Master
At line 77 changed 4 lines
{{{
omz> gcm
zsh> git checkout master
}}}
|| Description || Zsh || Git
| Checkout master | {{{gcm}}} | {{{git checkout master}}}
| Merge feature branch into master | {{{gm $feature_branch}}} | {{{git merge $feature_branch}}}
| Push master| {{{ggp}}} | {{{git push origin master}}}
At line 82 removed 10 lines
{{{
omz> gm $feature_branch
zsh> git merge $feature_branch
}}}
{{{
omz> ggp
zsh> git push origin master
}}}
At line 93 changed one line
[CategoryComputing.SCM.Git]
[CategoryComputing.SCM.Git] - [CategoryFrequent]