Git Hub Guide Part3
User Manual:
Open the PDF directly: View PDF .
Page Count: 9
Git and GitHub guide
Part 3
zero to mastery
Contribution To Open Source
Lection 148. We start from 05:41 minutes ( follow these steps)
1
2
test
3. git clone https://github.com/antonykidis/start-here-guidelines.git
4.Cd into start-here-guidelines.
5.ls
CODE_OF_CONDUCT.md CONTRIBUTORS.md 'Get Started.md' LICENSE README.md
6.Type start code . (for VS Code should open the entire folder)
7.Branch out git checkout -b test
8. Add your name to the list of contributors
9. Save all CTRL+S
10. git add .
11. git commit -m“test“
12. git push origin test
13. git push
14. go back to https://github.com
15. See a notification
16. Finish a pull request as
Appears in the video.
test
With the above steps in mind...
I did it using a different way...
Wait, don't close the guide because here
comes the very interesting thing I've encountered.
SO In the very beginning you could open, and edit the CONTRIBUTORS.md file via a github website.
So Why bother cloning a repo i said...How cool is that! Sure, you can do it too!
I decided to go to the forked repo https://github.com/antonykidis/start-here-guidelines
And to edit a contributors.md file manually, as you can see from this diagram
1
2
Click
Edit button
3 adding name
4Finally Click propose file change
5
6
Finish the compare and pull request by clicking
This button
By now i was really happy to be able to add
My self to the list as a contributor, without cloning
A repo. :-) Yahooooooooo :-)
You will recieved a new notification
So I really wanted to follow the video, and code along with Andrei.
But I really forgot about my pull request that I've previously made.
By now one of the administrators have merged my pull request into the master.
He added my name to Contributors list.
But somehow I've just followed along the video, and continued to edit contributors.md file via a local repo.
So, I finished all the procedures, and pushed a contributors.md file back into the GitHub.
But suddenly I realized that someone already merged a pull request, and my name
Is already on the contributor's list.
But i've pushed the contributer.md file again, and it cause a new notification to appear.
What the hell am I suppose to do now!?
...There is a notification out there! How to get rid of it?
I don't want to create a new pull request …...................Please HELP!
Luckily we have a solution.
1. Go to a forked repo and click commits link
Make sure you on the test branch (or the one you pushed last. Mine called fix)
2. Scroll down until you get the commits section
3. Click on the upper most commit.
4. Locate the commit ID
5. Copy the short ID (if not working, use the long Id instead)
6. Go back to Terminal and type this command git push origin +19fe22b^:fix
Hit Enter button. (use the above syntax for deleting a commits)
19fe22b
7. You will get the following output
8. Go back to GitHub (your forked repo)
9. Navigate again to a commits link
10. Repeat the steps 4-through -7 for
All of these commits
11. the above steps will remove
the notificaton about recent
Branch pushing
git push origin +idGoesHere^:branchname
The above command will delete the desired
Commit
Basically, once you remove all the commits,
The norification will gone.
12. once you've remove all the commits you
Can delete the remote branch by typing this
git push origin --delete fix
Yes you can delete branch
instead deleting the commits
As you can see i've successfully deleted
Commits and a remote branches
We now left with only one master branch on our
Forked repository :-)
What if we mistakenly entered a bad commit's message...
How can we fix a commit remotely, without pushing files again and again to a GitHub?
Solution:
1.Go to a forked repository, open commits link, and find a commit you want to fix.
2.Copy a commit's ID to a clipboard
3.Open terminal window
4 Use this command. git revert 9ad5cf54d3478497320490d4e11d9d34e0c6d8b3
5. hit ENTER
Next step...
6. If you on gitbash.exe, a new window will appear
Please enter the commit message for your changes
7.We want to change the commit message
remember?
8. hit the insert button on your keybord.
9. navigate to the yello string.
10. write a new commit comment.
11. hold SHIFT + : again.
12. in the vim command mode type wq
W= write
Q= quit
Which means write, and quit saving changes.
13. you finally will end up with this output.
Vim editor mode
This is our previous commit message
Entering the vim command mode
To Be Continued
.What is vim
And etc...