Contribute to open source using GIT
Supported by
Organized by


Question, fell free to ask at sli.do:
#KITM10
https://sli.do
How?
- Fork the project
- Clone the project that you fork
- Update and push changes
- Create a pull request
- That's it

Tell me how to do that, please???
Forking the project
For learning purpose, use this sample project to contribute.
Okay then, i already open that link
Now, find that fork button





Everything goes okay


Clone the project that you fork

Use the command bellow to clone project
git clone https://github.com/wilson-ng/SimpleContribute.git
git clone [repository link]
example:
You can get repository link from click "Clone or download" labeled button
You must clone instead of Download as Zip
I will show you why you must clone it
Downloaded project

Cloned project

That's all for clone the project

Update and Push changes
First we need to create new branch for our new feature
git checkout -b [branch-name]
example
git checkout -b add-my-name
After create a new branch, we can start working

Useful tips
- git checkout [branch-name]
use for switch branches or restore working tree files
- git checkout -b [branch-name]
use for create a new branch with specify branch name
- git checkout -t [upstream]/[branch-name]
use for create a new branch with branch name of remote tracking upstream branch name
For example, there are a task to do:
- Add your name
- Create Hello World! script
Update and Push changes
Add your name
update "CONTRIBUTORS.md", put your name and github link.
Create "Hello World!" script
create new file under scripts, see other scripts as a template.
Done??? Push your changes
Update and Push changes
To push your changes,
Look at what you changes with
git status

Update and Push changes
Look in detail what the hell you changes
git diff

Why new file of script doesn't show up???
git diff only tracking between commit or after indexing
Update and Push changes
Tell git to add your changes to be commit
git add .

Update and Push changes
Make sure what you changes, again...
git diff --staged

as you can see, that indexed file can be show the difference between commit
Update and Push changes
Commit your changes
git commit
example
git commit -m "add wilson"

Update and Push changes
Push your code, literally
# if you want to push new branch
git push -u origin [branch-name]
# if you want to push existing branch
git push origin [branch-name]
or
git push
DONE!!!


ALMOST DONE
Create pull request
Open your project on github
You will be notice that your recently pushed branch

Click "Compare & pull request"
Create pull request

Create pull request
Make sure to leave comment, so the other can know what you do
Make sure to choose base fork branch and head fork branch you want to merge to
Because you want to contribute to public project, make sure you still polite when create comment
If everything is okay and it's say able to merge,
hit "Create pull request" button
If contribution guide exists, you must read and follow it before do any changes or create a pull request
Useful tips
Find some simple project and contribute to the project, nothing to lose if you contribute to open source
Next step of this leason, you need to sync your master branch to base fork master branch, try to learn about fetch upstream and merge to your branch
That's it

Thank you
Kindly fill the feedback for the better meetup.
Contributing to open source using GIT
By Wilson Ng
Contributing to open source using GIT
Learn basic contribute to open source using GIT and github.com as provider
- 644