Dated: July 07, 2018
I conducted a Github workshop as part of a summer program conducted by the CSE department of IIT Madras. The workshop included the following assignments.
-
Create an account at https://github.com/
-
Clone the repository at https://github.com/devsjee/github-workshop.
-
Inside the 'Assignment-1/participants' folder, create a new file in your name, for ex : Rahul.txt .
-
Add the following details about yourself in the file:
name: email: github user name: Was the morning session easy to follow ? : Which topics you found difficult (if any) ? :
-
Stage and Commit the changes in local repository.
-
Push the changes back to the online github repository.
After around 15 mins,
- pull the changes in github repository to your local copy.
- Use git log to see the commits.
- Do you see the commits made by your friends? If yes, this assignment is complete.
- How many participants have added their files? 44?
- Login to your github account. Fork the repository at https://github.com/devsjee/github-workshop to your account. Clone your copy of github-workshop from your github account.
- See what branch you are currently on: git branch (the * near master means you are on master branch).
- Make a new branch: git checkout -b add-your-name (the -b means "make a new branch").
- Now see what branch you're on: git branch (you'll see 2 branches, with the * beside add-your-name).
- Edit the participants.java file inside 'Assignment-2' folder and include your details.
- Test your change. If this were a big colloborated project, you would be doing this multiple times until your code works perfectly.
- When you're ready to commit, "Stage" your files for commit.
- Commit your change (to the add-my-name branch): git commit -m "Added my details to participants.java file".
- Switch back to master branch: git checkout master (note: no -b).
- Open up participants.java file again. Are your changes reflected? (It won't be because those changes are in add-your-name branch).
- Merge add-your-name into master: git merge add-your-name.
- Open up participants.java again. Now you should see your edits. Resolve any conflicts that arise.
- Push your changes to GitHub: git push origin master.
- Go to github.com and see your changes.
- Keep your repository tidy! Delete the branch add-your-name now as that it's done: git branch -d add-your-name.
Did you face any conflicts while merging branch with master? Why?
- What is your favourite Git command? You can either pick one from what was taught in workshop or explore to find new commands. Sometimes, even a known command has many useful options that were not discussed. You can even pick one such option.
- Pull to get the latest repository from github.
- Edit the 'favCommands.txt' inside the 'Assignment-3' folder to include your favourite command along with an example and description of its use.
- Stage and commit with an appropriate message.
- Resolve any merge conflicts that arise.
- Pro Git book written by Scott Chacon and Ben Straub, availabel at https://git-scm.com/book/en/v2
- Quick reference on github: http://rogerdudler.github.io/git-guide/
- Assignment-2 reference: https://github.com/adamaflynn/MergingAssignment