Git and GitHub workshop for beginners
Open a new New contributor
with your name at the title (replace <your_name>
)
Clone the fork into your new folder:
$ git clone https://github.com/<USER_NAME>/beginners-workshop
Go into the git directory:
$ cd beginners-workshop
Open the dir beginners-workshop
in your text editor
Create a new feature branch:
$ git branch <feature_yourname>
$ git checkout <feature_yourname>
$ git branch -a
OR shorthand version:
$ git checkout -b <feature_yourname>
Create a new file under the contributors
dir: <your_name.md>
Copy this into contributors/your_name.md file:
Your name:
Why you came to the workshop?
Is this your first event?
Favorite animal?
What is GitHub user URL?
Check the status of your changes:
$ git status
Your file is not being track by git, we need to add it
Add contributors/your_name.md to the repo:
$ git add contributors/<your_name.md>
TIP: git add stages your changes. You cannot commit your changes until you have first staged them.
Check the status again to see the staged file:
$ git status
Commit your changes: "Commit early and commit often"
$ git commit -m "Add your commit message here"
Push your branch to the remote:
$ git push
You will get the following error:
fatal: The current branch <feature_yourname> has no upstream branch.
To push the current branch and set the remote as upstream, use
This error is happening becasue your branch only exsits locally and not on the server
So let's fix that:
$ git push --set-upstream origin <feature_yourname>
$ git status
Go to your fork on GitHub and click Compare & pull request
Add your issue number to the PR title (e.g. #2)
Comapre changes and submit your message
Once your PR has been merged, you should delete your feature branch
$ git push --delete origin <feature_yourname>
$ git branch -d <feature_yourname>
Once the PR will be merged, your profile will be added to this file:
list_of_contributors.md
Feel free to share your feedback so we will know how to improve for next time :)