Skip to content

Latest commit

 

History

History
90 lines (71 loc) · 4.14 KB

File metadata and controls

90 lines (71 loc) · 4.14 KB

Extecamp First Contributions

This project was created using First Contributions as a starting point as well as Unicamp professor Rodrigo Bonacin's assignment with the objective of helping Extecamp Microsoft Technologies (Campinas State University) course students on Git version control, serving also as an exercise of maintaining a small GitHub repository.

Before you start, it's mandatory to install Git following the official documentation: https://git-scm.com/downloads or https://docs.github.com/en/get-started/quickstart/set-up-git

You might also need to authenticate with GitHub from Git

Forking a project

Open up the GitHub repository and make a Fork to your profile by cligking on the icon Fork at the top-right corner. This will copy this repository to your GitHub profile.

git status

Cloning the repository

git status

Now you can clone the repository to your local machine. Open your account repository (the Fork you just created) and click on the dropdown menu <> Code. Copy that link:

After copying the code URL, execute the following Git command in a folder of your preference:

git clone <copied-url>

Alternatively, you can also use a SSH URL to clone the repository:

git clone git@github.com:this-is-you/first-contributions.git

Where this-is-you is your GitHub username.

Creating a branch

Enter on your repository folder by executing the command cd:

cd extecamp-first-contributions

Now, create a branch using the command git branch:

git switch -c <your-branch-name>

For example:

git switch -c add-lucas-m

Making changes in code

Open up the C# file HelloProject/hello.cs inside a code editor of your like (VSCode, Vim, etc). After the comment on the line 21, add a Hello World print where <your-name> is your name or GitHub username, for example:

Console.WriteLine("Hello world! My name is <seu-nome>");

Example:

Console.WriteLine("Hello world! My name is Lucas");

To verify the changes you've made, execute the command git status. Now, to stage your changes, run the command:

git add HelloProject/hello.cs

You can create a commit message with your changes to send it to a pull request:

git commit -m "Add <your-name> to Extecamp Contributors"

Git Push

Now, for your changes to be live in the main(or master) branch, you'll need to push your local code to the remote repository. We'll then run the command:

git push -u origin <nome-de-sua-branch>

Where <nome-de-sua-branch> is the branch name you created earlier.

Sending your changes through a Pull Request

In your GitHub repository you'll now find a tab called Compare & Pull Request git status By clicking this button, you'll open up a window to submit your changes to the remote repository. This will show the comparison with the lines you added, changed or the files you inserted/removed.

git status

After the pull request, it will be possible to verify and check the comparions of the lines changed, functions, files, etc.

git status

When your pull request is finally submitted, I can then merge your changes with the main branch and you'll be able to see your name on the project!

Summarizing

Now you're familiar with the workflow using Git + Github as a remote repository. You can also follow the tutorials provided by First Contributions -- which are the original source I used to build this tutorial -- to create your first commits and pull requests, as well as be able to contribute to Open Source projects!

License

(C) Lucas Mellone 2023 under MIT License. You can fork, copy, use, modify, and distribute this repository without restriction.