0
0
Gitdevops~10 mins

Squashing commits in Git - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to start an interactive rebase for the last 3 commits.

Git
git rebase -i HEAD~[1]
Drag options to blanks, or click blank then click option'
A3
B4
C2
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong number after HEAD~
Forgetting the -i flag for interactive mode
2fill in blank
medium

Complete the command to squash the current commit into the previous one during interactive rebase.

Git
In the editor, replace 'pick' with '[1]' for the commit to squash.
Drag options to blanks, or click blank then click option'
Afixup
Bdrop
Cedit
Dsquash
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'fixup' when you want to edit the message
Using 'edit' which pauses rebase for changes
3fill in blank
hard

Fix the error in the command to abort an ongoing rebase.

Git
git rebase --[1]
Drag options to blanks, or click blank then click option'
Areset
Bcontinue
Cabort
Dskip
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--continue' instead of '--abort'
Using '--skip' which skips the current patch
4fill in blank
hard

Fill both blanks to create a new commit message during squash.

Git
After squashing, edit the message and save with [1] then exit with [2].
Drag options to blanks, or click blank then click option'
A:wq
B:q!
C:w
D:x
Attempts:
3 left
💡 Hint
Common Mistakes
Using ':q!' which discards changes
Using ':w' without quitting
5fill in blank
hard

Fill all three blanks to squash commits and push changes safely.

Git
git rebase -i HEAD~[1] && git push origin [2] --[3]
Drag options to blanks, or click blank then click option'
A3
Bmain
Cforce-with-lease
Dmaster
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--force' instead of '--force-with-lease'
Pushing to wrong branch name