- Navigate to https://github.com/kenjikamimura/git-gud-2020
- Click on the Fork button. This creates your own copy of the reporitory on your own Github account.
-
In your own fork repository on github, click on the green "Clone or download" button and copy the url of it. (It should look like something like this: https://github.com/sy133/git-gud-2020.git where your github user name is in the url).
-
In your terminal, navigate to where you would like clone the project. Then type the command below. (This will copy the repository in github to your local computer).
git clone https://github.com/<Your github username>/git-gud-2020.git
-
Navigate into the repository:
cd git-gud-2020
- Open the repository in your favourite text editor (VsCode) and create a new text file with your name (e.g: kenjikamimura.txt).
-
Save the text file and in the terminal type the command below:
git status
-
This will show that the newly added file is unstaged/untracked
-
Type the command below. This will move the newly added file to the staging area
git add <name of the newly added file> e.g: git add kenjikamimura.txt
Type the command below.
git status
-
Type the command below. Ensure you use a good commit message as these will help keep track of your code changes.
git commit -m "New kenjikamimura.txt file and added a new line"
-
Type the command below. This will show a log of the current history.
git log --oneline
-
You should see your newly added commit at the end of the log. Dont worry if you see more than 1 log entry. These show all the other commits made by other people before you cloned the repository.
- Now that you have created a commit, add a second line to the file you created.
- Save the file.
- Add the changes using
git add <file name>
- Commit the changes using
git commit -m <commit message>
- Using
git log --oneline
you will now be able to see the second commit!
- Repeat step 9 and check the git log. You should see a third commit you made!
- Congratulations! You have successfully added version control to your new file! The following steps help create a pull request to get these new changes into the remote repostory.
-
The command below will push all the new commits to the master branch in your forked remote repository. (Note: origin is the default name given to the remote repository)
git push origin master
-
Navigate to your fork URL (e.g. https://github.com/sy133/git-gud-2020)
-
Check the fork you wish to make the pull request from is your personal forked repository master branch
-
Click the green "Create pull request" button.
-
Congratulations, you have successfully made a Pull Request to the remote repository. Now you will have to wait until the owner of the repository approves and merges your pull request.
-
Once your changes have been approved and merged, you can see your changes and other people's changes to the remote repository on https://github.com/kenjikamimura/git-gud-2020
-
These changes are now part of the source of truth!