In this task, you'll learn basics of Git and Github.
Git is a distributed version control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals include speed, data integrity, and support for distributed, non-linear workflows.It is a web-based Git repository. This hosting service has cloud-based storage. GitHub offers all distributed version control and source code management functionality of Git while adding its own features. It makes it easier to collaborate using Git.
Head over to https://github.com/EnigmaVSSUT/Induction-2023 and click on the fork button. This creates a copy of this repository in your repositories so you can start working on the project without directly making changes in the owner's code.
Now, go to your profile and you should see Induction-2023 repository under your repositories. This is your forked repo.
Now that you have your own copy of the repository it's time to make a copy of it on your local system so you can start contributing to the project.
- Now go to your forked repository, click on code and copy the repo address. This will be used to clone the repository to your local system.
- Go to the folder you'd like to make the copy of the repository and open git bash. This can be done by right clicking inside the folder and selecting the "Git Bash here" option. You must have git installed in order for this command to show up in the menu.
- Now create a text file named your_name.txt inside the
Open_Source/Task-1
folder. Add your details like- name
- registration number
- branch
- your hobbies
For reference see the file Satyajit_Pradhan.txt in the Task-1 folder.
- Close any previous gitbash windows and open a new gitbash inside the newly cloned Induction-2023 folder. Then type
git add .
. This command adds all the changes you make to a staging area. This includes changes made in existing files as well as any new files that you create. Running the git add command does not change any of your work in the Git repository. Changes are only made to your repository when you execute the git commit command. - Now to commit these changes, type
git commit –m "git task 1 completed"
in the gitbash. The commit message must contain useful information as to what changes you've made so that it is easier for others to understand what your code does. - After you've committed the changes you'd want these changes to reflect on your GitHub repository too. For that, type
git push origin main
in the gitbash. In Git, "origin" is a shorthand name for the remote repository that a project was originally cloned from. More precisely, it is used instead of that original repository's URL - and thereby makes referencing much easier. The git push command pushes all the changes to remote repository. - Now go to the pull requests tab and click on "New pull request". Click through and create a pull request. pull requests are a mechanism for a developer to notify team members that they have completed a feature. Once their feature branch is ready, the developer files a pull request via their GitHub account.
The link might look different for you and will have your username in place of SatyaSP.
Type the command
git clone copied_repo_address
Wait till the pull request is approved and merged to the original repository.