Here is short video (only 3 minutes) and good explanation of git rebase -i usage.
list your local repository log
list your logs in oneline
If you want to combine these 3 commits (add6152, 3650100, 396a652) to 1 commit, execute this command
git rebase -i HEAD~3 # last three commits
list last three commits
Select which commit you want to squash (type s or squash are OK)
combine three commits to one
then press ESC, enter :wq! to save and exit.
comment out some commits message you don't need
Comment out some commits message you don’t need, press ESC, enter :wq! to save and exit.
comment out some commits message you don't need
Check log, you will see your local repository logs has combine to one commit
comment out some commits message you don't need
If your commits had pushed to remote
combine remote commits, you could follow this flow
list your repository logs
list your logs in oneline
# so you can create another branch from bugfix/UNV-1234 named bugfix/UNV-1234-for-squash xshen@dln-l-xs01 MINGW64 /c/U2GitCode/git-test (bugfix/UNV-1234) $ git checkout -b bugfix/UNV-1234-for-squash Switched to a new branch 'bugfix/UNV-1234-for-squash'
# combine last 2 commits $ git rebase -i HEAD~2
change one commit from pick to squash, see the screenshot below. press ESC, enter :wq! to save and exit.
select a commit you want to squash
change commit message, for example “UNV-1234 combine all commit to one commit”, then press ESC, enter :wq! to save and exit.
comment out commit message you don't want to display
# push your new create branch to remote. git push -u origin bugfix/UNV-1234-for-squash
Recently, my Jenkins build failed when execute git clone with following this error message: ERROR: Error cloning remote repo ‘origin’.
first I suspect it is the network reason, maybe because clone from Bitbucket need took up a lot bandwidth during git clone and causing this disconnection. but when I try to git clone on the agent, it works well.
Then I noticed the there is timeout=10 in the Jenkins console log, I suddenly remembered that I deleted a very large folder a few days ago from git repo, and this may cause the repo more bigger, so it may take more time do a complete clone and it exceeds the Jenkins default clone timeout 10.
Googling and finally I found this issue JENKINS-47660 which is the same problem as mine.