Github Workshop - Task 2

Part A:

Pushing your DSA/Java assignments on a new Github Repository , Git clone and Git push

Make a new github repository by the name DSA_assignments or Java_assignments and make sure it's set to Public

image

  • Clone this repository using git clone followed by the github repository's url:
git clone *github repository url"

Eg:
git clone https://github.com/your_username/Dsa_assignments.git

image

  • Go to that folder using cd, you can verify that you're in the right folder using pwd and you should see the folder path ending with the name DSA_assignments (i.e. your github's repository's name)
  • Open this folder in File explorer and copy your DSA (.c files) or .Java files in case of Java, and paste it here
  • Commit the changes and push it to Github

Part B:

Collaborating with your friends, Git pull

  • Add one of your friend as a collaborator in your Github repository, this will allow your friend to push and make changes to the files in your repository without using pull requests.
  • Collaborator is something similar to how we share the google doc sheets by giving editor access to our friends who can later make changes to those files.

How to add someone as a collaborator in your repository?

  • Ask him to clone this repository, make few change on one of the code files and push it onto the same repository i.e. Yours Eg: in a stack code, let him make changes on the push function
  • Make him push these changes to your repository
  • To have these updated changes in your local repository use:
git pull origin main
  • Now on the same file, you also need to make changes but make sure that you choose a different function or a different line than the one where your friend made the change. Eg: you can work on the pop function
  • Commit the change which you made and push it back to github
  • Now you will see two contributors in your repository, one will be you while the other one is going to be your friend.

We expect you help each other to complete the task and learn together If you face any problems with any of the tasks or steps, please contact the instructors; they will be happy to help you.

Remember that if it's difficult for you, it's probably difficult for others as well. These tools are obviously unfamiliar to you, so you may encounter difficulties; however, with a little guidance and support from us and your hard work, you should be able to complete all of the tasks successfully.

Link for task1