Kiril

Git – Squash 3 commits to one

Practical example, how to make one commit after 3 pushed commits:

///new branch
git checkout -b test
//add some changes and make commit
git commit -am "first commit"
//add some changes and make commit
git commit -am "second commit"
//add some changes and make commit
git commit -am "third commit"
git push

//merge 3 last commits
git reset --soft @~3
git commit -am “merged 3 commit”
git push --force


git commit -am “first commit”

//changes

git commit -am “second commit”

//changes

git commit -am “third commit”

git push

git reset –soft @~3

git commit -am “merged commit”

git push //if was not pushed

git push –force //if was pushed

Kiril

Moodle – Upgrade version with Git from 3.3-3.*

First Step: 

 git remote add upstream https://github.com/moodle/moodle.git

Second Step: 

vim update.sh 
#!/bin/bash
git fetch upstream
for BRANCH in MOODLE_{31..37}_STABLE master;
do
git push origin refs/remotes/upstream/$BRANCH:refs/heads/$BRANCH
done

Source: https://docs.moodle.org/dev/Git_for_developers