This is an empty repo to practice git commands Below are the assignments to practice. Please let me know if you get any issues.
Put relevant git commands beside the each steps and create a document as part of learning.
Assignment 1:
- On your GitHub account, fork this repo https://github.com/raghuck/git-basics-practice
- Clone the forked repo from your account on to your local
- Navigate inside the cloned folder
- Check the current branch of the cloned folder
- heck the remote repo of the cloned folder
- Pull the changes
- Create a new branch named “feature1”
- Switch to the newly created branch
- Verify you are in the new branch
- Create a new file named homepage.html and put some sample content in it
- Check the status of the changes
- Add the new file to staging area
- Commit the new changes
- Push the new changes to feature1 branch
- On the Github dashboard, change to feature1 branch
- Verify the new changes appear in the Github repo dashboard
Assignment 2:
- On the Github dashboard, create a new branch named “dev” by selecting source as the master branch
- Create a Pull request to merge the feature1 branch to dev branch
- Go to Pull requests, then approve and merge the changes
- Change to the dev branch
- Verify the merge changes are visible in the dev branch
- On your local terminal, List the branches
- Pull the changes to your local
- Switch to the dev branch
- List the branches and see that current branch should be dev
- Verify the merged changes are present in the dev branch in the local terminal
Assignment 3:
- On the Github dashboard, create a new branch named “feature2” by selecting source as the master branch
- On your local terminal, pull the changes to your local
- Switch to the feature2 branch
- Create a new file named aboutus.html with put some sample content in it
- Check the status of the changes
- Add a new file to staging area
- Commit the new changes
- Push the new changes
- On the Github dashboard, verify the new pushed changes are visible in the feature2 branch
- Create a Pull request to merge the feature2 branch to dev branch
- Go to Pull requests, then approve and merge the changes
- On your local terminal, pull the changes to your local
- Switch to the dev branch
- Verify the merged file is visible in the terminal in the dev branch
Assignment 4:
- On the Github dashboard, create a new branch named “stage” by selecting source as the master branch
- Create a Pull request to merge the dev branch to stage branch
- Go to Pull requests, then approve and merge the changes
- Change to the stage branch
- Verify the merge changes are visible in the stage branch
- On your local terminal, pull the changes to your local
- Switch to the stage branch
- Verify the merged file is visible in the terminal in the stage branch
Assignment 5:
- On the Github dashboard, create a new branch named “feature3” by selecting source as the main branch
- On your local terminal, pull the changes to your local
- Switch to the feature3 branch
- Verify you are in the feature3 branch
- Create a new file named aboutus.html with put some sample different content in it
- Check the status of the changes
- Add the new file to staging area
- Commit the new changes
- Push the new changes to feature3 branch of Github
- On the Github dashboard, verify the new changes are visible in the feature3 branch
- Create a Pull request to merge the feature3 branch to dev branch
You will see merge conflicts which won’t allow you to merge from the GitHub dashboard. We have to resolve merge conflicts and then merge from the dashboard. Otherwise we can force merge from the terminal. Let's try that. 13. On your local terminal, pull the changes to your local 14. Switch to dev branch 15. Verify you are in the dev branch 16. Merge the branches from the feature3 branch to dev branch 17. Verify the merge changes are visible in the dev branch 18. Push the merged changes 19. On the Github dashboard, verify the merged file changes are visible in the Github repo dashboard of dev branch
Assignment 6:
- On the Github dashboard, create a Pull request to merge the dev branch to stage branch
- Go to Pull requests, then approve and merge the changes
- Change to the stage branch
- Verify the merge changes are visible in the stage branch
- On your local terminal, pull the changes to your local
- Switch to the stage branch
- Verify the merged file is visible in the terminal in the stage branch
- Check the git logs for the commit hash
- Revert back to the commit made in the assignment4
- Check the git logs to see the previous reverted commit hash
- Force push the changes to Github to overwirte the head
- Verify the reverted changes are visible in the terminal in the stage branch
- On the Github dashboard, verify the reverted changes are visible in the GitHub dashboard