Skip to content

Latest commit

 

History

History
70 lines (56 loc) · 1.91 KB

03-Practice-Test-Rebasing.md

File metadata and controls

70 lines (56 loc) · 1.91 KB

Practice Test - Rebasing

Solutions to practice test - Git Rebasing

  • Click on the Gitea Portal UI button and enter the credentials given in the screen. Open the sarah story-blog repository. Click on the Commits.

    Solution
    $ Last commit has done by tom
    
  • Run the command to pull all the changes from remote to our local master branch.

    Solution
    $ cd /home/sarah/story-blog
    $ git checkout master
    $ git pull origin master
    
  • Run the following command to check the availability of the story-index.txt file in the current working directory.

    Solution
    $ ls 
    
  • Run the following command to checkout the story/hare-and-tortoise branch and count the total of commits.

    Solution
    $ git checkout story/hare-and-tortoise
    $ git log --oneline
    
  • Run the following command to checkout the story/hare-and-tortoise branch and then rebase master branch.

    Solution
    $ git checkout story/hare-and-tortoise
    $ git rebase master
    
  • Run the following command to check the current status of commit.

    Solution
    $ git log
    
  • Run the following command to squash all the commits into a single commit. It opens the editor. Leave the first line and change the second and third lines to use squash instead of pick then save the file and exit with :wq. It will open again a file in the editor. Add the commit message "Add hare-and-tortoise story" with press i then save the file and exit with :wq.

    Solution
    $ git rebase -i HEAD~3