These exercises aim to give you some practice with using the Git version control system. | |
# Find someone to work with. | |
# Both people: | |
# Go register for github | |
# Setup your SSH key (Windows, Linux), also note the Windows git setup | |
# Should be able to SSH to github: ssh git@github.com | |
# First person, click the New Repository button on the github.com homepage, push a file to it: | |
$ mkdir git-workshop | |
$ cd git-workshop | |
$ git init | |
$ touch README | |
$ git add README | |
$ git commit -m 'first commit' | |
$ git remote add origin git@github.com:/git-workshop.git | |
$ git push origin master | |
# Second person, go to github.com//git-workshop, fork their repository, and then checkout your copy of it: | |
$ git clone git@github.com:/git-workshop.git | |
$ cd git-workshop | |
$ cat README | |
# Change README | |
$ echo "from user2" >> README | |
$ git commit -a -m "Updated the readme." | |
# Push user2's change back to user2's clone | |
$ git push | |
# First person, pull in user2’s change into your local repo: | |
# Pull down user2's work | |
$ git remote add user2 http://github.com/user2/git-workshop.git | |
$ git fetch user2 | |
# Diff your master to user2's master | |
$ git diff master..user2/master | |
# Merge user2's changes | |
$ git merge user2/master | |
# Add your own change to README | |
$ echo "from user1" >> README | |
$ git commit -a -m "Updated the readme." | |
# Push the changes to your user1 repo | |
$ git push | |
# Second person, pull in user1’s changes, and update your repo: | |
# Pull down user1's work | |
$ git remote add user1 http://github.com/user2/git-workshop.git | |
$ git fetch user1 | |
# Diff against what they added | |
$ git diff master..user1/master | |
# Merge user1's changes | |
$ git merge user1/master | |
$ cat README | |
# Push their changes out to your user2 repo | |
$ git push |
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND