Horje
git squash branch Code Example
git squash branch
# Assuming you were branching from the master,
# you don't need to enter yourBranch into the reset step all the time:
git checkout yourBranch
git reset --soft HEAD~$(git rev-list --count HEAD ^master)
git add -A
git commit -m "one commit on yourBranch"

# Explanation:

git rev-list --count HEAD ^master counts the commits since you made your feature branch from the master, f.ex. 20.
git reset --soft HEAD~20 will make a soft reset of the last 20 commits. This leaves your changes in the files, but removes the commits.

#Usage:
# In my .bash_profile I have added an alias for gisquash to do this with one command:

# squash all commits into one
alias gisquash='git reset --soft HEAD~$(git rev-list --count HEAD ^master)'
#After reseting and committing you need to do a
git push --force




Shell

Related
digitalocean how to restart server Code Example digitalocean how to restart server Code Example
install dicker machine Code Example install dicker machine Code Example
download images from url terminal Code Example download images from url terminal Code Example
how to install lvm2 on ubuntu Code Example how to install lvm2 on ubuntu Code Example
ssh kali linux command Code Example ssh kali linux command Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11