0% found this document useful (0 votes)
38 views98 pages

DevOps Git

github

Uploaded by

Abdul Hadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views98 pages

DevOps Git

github

Uploaded by

Abdul Hadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 98

Git

© Copyright KodeKloud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Home Contact Abbout

Explore nature
in Canada.
See more

👩🏼‍💻
© Copyright K odeK l oud Check out our full course on GIT for Beginners: https://kode.wiki/3MUhuve
www.mywebsite.com local

Home Contact Abbout Home Contact Abbout

Explore nature Explore nature


in Canada. in Canada.
See more See more

👩🏼‍💻
© Copyright KodeKloud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
www.mywebsite.com local

Home Contact Abbout Home Contact About

Explore nature
Explore nature in Canada.
Visit Canada’s lakes and
in Canada. mountains.

See more See more

👩🏼‍💻
© Copyright KodeKloud Check out our full course on GIT for Beginners: https://kode.wiki/3MUhuve
www.mywebsite.com local

Home Contact Abbout Home Contact About

Explore nature
Explore nature in Canada.
Visit Canada’s lakes and
in Canada. mountains.

See more See more

🤷🏼‍
🤦🏼‍
👩🏼‍💻
© Copyright KodeKloud Check out our full course on GIT for Beginners: https://kode.wiki/3MUhuve
Git
© Copyright K odeK l oud Check out our full course on GIT for Beginners: https://kode.wiki/3MUhuve
Content tracker

Distributed Version Control System

Git
© Copyright KodeKloud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Home Contact About

Explore nature
in Canada. New state of your website with
Visit Canada’s lakes and
mountains.
the local changes
See more

Home Contact Abbout

Explore nature
Hosted state of your website
in Canada.
See more

© Copyright K odeK l oud Check out our full course on GIT for Beginners: https://kode.wiki/3MUhuve
Fixed button CSS
@ma 🙋🏽‍ 12.23AM
x

Changed background image @sara


🙋🏼‍ 11.15AM

Added sub title @tim


💁🏼‍ 11.05AM

@ma 🙋🏽‍
Fixed buttons in navigation x 10.45AM

Added front page @sara


🙋🏼‍ 10.24AM

© Copyright KodeKloud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Home Contact Abbout

Explore nature
in Canada.
Visit Canada’s lakes and
mountains.

See more
Change background

Home Contact Abbout

Explore nature
in Canada.
Added front page
See more

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Home Contact Abbout

Explore nature
in Canada.
Visit Canada’s lakes and
mountains.

See more
Change background

Home Contact Abbout

Explore nature
in Canada.
Added front page
See more

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Home Contact Abbout

Explore nature
in Canada.
Visit Canada’s lakes and
mountains.

See more
Change background

Home Contact Abbout

Explore nature
in Canada.
Added front page
See more

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
www.mywebsite.com

Home Contact About

Explore nature
in Canada.
See more

Home Contact Abbout Home Contact About

Explore nature
in Canada.
Visit Canada’s lakes and
Explore nature
in Canada.
mountains.

See more
Change background Fixed button typo See more

Home Contact Abbout

Explore nature
in Canada.
Added front page
See more

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
www.mywebsite.com

Home Contact About

Explore nature
in Canada.
See more

Home Contact Abbout Home Contact About

Explore nature
in Canada.
Visit Canada’s lakes and
Explore nature
in Canada.
mountains.

See more
Change background Fixed button typo See more

Home Contact Abbout

Explore nature
in Canada.
Added front page
See more

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Remote Repository

Local Repository

<html>
<body>
👩🏽
<h1>My Website!</h1>
</body>
</html>

© Copyright K odeK l oud Check out our full course on GIT for Beginners: https://kode.wiki/3MUhuve
Remote Repository

<html>
<body>
<h1>My Website!</h1>
</body>
</html>

Local Repository
Local Repository
👱🏾‍
<html>
<body>
👩🏽
<h1>My Website!</h1>
</body>
</html>

© Copyright KodeKloud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Remote Repository

<html>
<body>
<h1>My Website!</h1>
</body>
</html>

Local Repository
Local Repository
👱🏾‍
<html>
<body>
👩🏽
<h1>My Website!</h1>
</body>
</html>

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Remote Repository

<html>
<body>
<h1>My Website!</h1>
</body>
</html>

Local Repository
Local Repository
👱🏾‍
<html>
<body>
👩🏽 <html>
<body>
<h1>My Website!</h1>
<h1>My Website!</h1>
<p>This is some more text!</p>
</body>
</body>
</html>
</html>

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Remote Repository

<html>
<body>
<h1>My Website!</h1>
</body>
</html>

Local Repository
Local Repository
👱🏾‍
<html>
<body>
👩🏽 <html>
<html>
<body>
<body>
<h1>My
<h1>MyWebsite!</h1>
Website!</h1>
<h1>My Website!</h1>
<p>This
<p>Thisisissome
somemore
moretext!</p>
text!</p>
</body>
</body>
</body>
</html>
</html>
</html>

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Remote Repository

<html>
<html>
<body>
<body>
<h1>My Website!</h1>
<h1>My Website!</h1>
<p>This is some more text!</p>
</body>
</body>
</html>
</html>

Local Repository
Local Repository
👱🏾‍
<html>
<body>
👩🏽 <html>
<html>
<body>
<body>
<h1>My
<h1>MyWebsite!</h1>
Website!</h1>
<h1>My Website!</h1>
<p>This
<p>Thisisissome
somemore
moretext!</p>
text!</p>
</body>
</body>
</body>
</html>
</html>
</html>

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Local Repository

Working Area Staging Area Committed Files

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Fixed button CSS
@ma 🙋🏽‍ commit
x

Changed background image @sara


🙋🏼‍ commit

Added sub title @tim


💁🏼‍ commit

@ma 🙋🏽‍ commit


Fixed buttons in navigation x

Added front page @sara


🙋🏼‍ commit

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Local Repository

Working Area Staging Area Committed Files

story2.txt

story1.txt

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Check out our full course on GIT for Beginners: https://kode.wiki/3MUhuve

© Copyright K odeK l oud


Initialize Git Repo
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ git init
Initialized empty Git repository in
/Users/lydiahallie/Desktop/myproject/.git/

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ ls -a
. .. .git

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ touch story1.txt
$ echo "This is a beautiful story" >> story1.txt

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ git status
On branch master

No commits yet

Untracked files:
story1.txt

nothing added to commit but untracked files present

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

Working Area Staging Area Committed Files

story1.txt

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ git add story1.txt

Working Area Staging Area Committed Files

story1.txt

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ git commit -m "Added first story"

Working Area Staging Area Committed Files

story1.txt

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Added first story
@ 🙋🏼‍
me

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Check out our full course on GIT for Beginners: https://kode.wiki/3MUhuve

© Copyright K odeK l oud


Git log
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ git log
commit 67c833e3…ecb7df62f (HEAD -> master)

Author: John Doe <john@doe>

Date: Sun Jun 14 14:45:07 2020 -0700

Added first story

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ git log —-oneline


67c833e (HEAD -> master) Added first story

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Check out our full course on GIT for Beginners: https://kode.wiki/3MUhuve

© Copyright K odeK l oud


Branches
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Check out our full course on GIT for Beginners: https://kode.wiki/3MUhuve

© Copyright K odeK l oud


Merging
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Check out our full course on GIT for Beginners: https://kode.wiki/3MUhuve

© Copyright K odeK l oud


Initializing a remote repo
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Connection
String

https://.../.../[name].git

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ git remote add origin https://.../.../[name].git

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Local Repository

Working Area Staging Area Committed Files

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
https://.../.../[name].git
Remote Repository

Local Repository

Working Area Staging Area Committed Files

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ git remote -v
origin https://.../.../[name].git (fetch)
origin https://.../.../[name].git (push)

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Check out our full course on GIT for Beginners: https://kode.wiki/3MUhuve

© Copyright K odeK l oud


Pushing
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Remote Repository

Local Repository

<html>
<body>
👩🏽
<h1>My Website!</h1>
</body>
</html>

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ git push origin master

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Added fifth story
@ 🙋🏼‍
me

Added fourth story


@ 🙋🏼‍
me

Added third story


@ 🙋🏼‍
me

Added second story


@ 🙋🏼‍ local remote
me

Added first story


@ 🙋🏼‍
me

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Check out our full course on GIT for Beginners: https://kode.wiki/3MUhuve

© Copyright K odeK l oud


Cloning
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ git clone <ssh link>

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ git clone git@github.com:….…git


Cloning into 'remote-repo'...
remote: Enumerating objects: 59, done.
remote: Counting objects: 100% (59/59), done.
remote: Compressing objects: 100% (43/43), done.
remote: Total 2948 (delta 28), reused 18 (delta 6)
Receiving objects: 100% (2948/2948), 1.93 MiB | 2.53 MiB/s, done.
Resolving deltas: 100% (1526/1526), done.

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ cd remote-repo
$ git log
commit 67c833e3…ecb7df62f (HEAD -> origin/master)

Author: John Doe <john@doe>

Date: Sun Jun 14 14:45:07 2020 -0700

Added first story

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Pull Request
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
sarah max
@ma
Added second story @sarah 👩🏽‍💻 Added third story
x 🧔🏻
🧔🏻

Added first story


@ 🙋🏼‍ master origin/master
me

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ git push origin sarah

origin/sarah sarah max


@ma
Added second story @sarah 👩🏽‍💻 Added third story
x 🧔🏻

Added first story


@ 🙋🏼‍ master origin/master
me

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Check out our full course on GIT for Beginners: https://kode.wiki/3MUhuve

© Copyright K odeK l oud


Fetching and Pulling
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ git fetch origin master

origin/sarah sarah max


@ma
Added second story @sarah 👩🏽‍💻 Added third story
x 🧔🏻

Added first story


@ 🙋🏼‍ master origin/master
me

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ git merge origin/master

origin/master

origin/sarah sarah max


@ma
Added second story @sarah 👩🏽‍💻 Added third story
x 🧔🏻

Added first story


@ 🙋🏼‍ master
me

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ git pull origin master

origin/sarah sarah max


@ma
Added second story @sarah 👩🏽‍💻 Added third story
x 🧔🏻

Added first story


@ 🙋🏼‍ master origin/master
me

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Check out our full course on GIT for Beginners: https://kode.wiki/3MUhuve

© Copyright K odeK l oud


Merge Conflicts
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Merge sarah into master @sarah 👩🏽‍💻
sarah max master
@ma
Added second story @sarah 👩🏽‍💻 Added third story
x 🧔🏻

Added first story


@ 🙋🏼‍
me

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
fourth_story.md fourth_story.md

## Fourth Story ## Fourth Story

This is Sarah’s version This is Max’s version


of the fourth story! of the fourth story!

Some extra stuff Sarah


added

sarah max
@ma
Started fourth story @sarah 👩🏽‍💻 Started fourth story
x 🧔🏻

master

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
sarah max
@ma
Started fourth story @sarah 👩🏽‍💻 Started fourth story
x 🧔🏻

master

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
master sarah max
@ma
Started fourth story @sarah 👩🏽‍💻 Started fourth story
x 🧔🏻

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
fourth_story.md fourth_story.md

## Fourth Story ## Fourth Story

This is Sarah’s version This is Max’s version


of the fourth story! of the fourth story!

master sarah max


@ma
Started fourth story @sarah 👩🏽‍💻 Started fourth story
x 🧔🏻

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
fourth_story.md

## Fourth Story

<<<<<<<< HEAD
This is Sarah’s version
=======
This is Max’s version
>>>>>>> max
of the fourth story!

Some extra stuff Sarah


added

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
fourth_story.md

## Fourth Story

<<<<<<<< HEAD
This is Sarah’s version
=======
This is Max’s version
>>>>>>> max
of the fourth story!

Some extra stuff Sarah


added

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ git add fourth_story.txt


$ git merge

master sarah max


@ma
Started fourth story @sarah 👩🏽‍💻 Started fourth story
x 🧔🏻

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
bash

$ git add fourth_story.txt


$ git merge

@ma
Merge max into master
x 🧔🏻
master sarah max
@ma
Started fourth story @sarah 👩🏽‍💻 Started fourth story
x 🧔🏻

© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Check out our full course on GIT for Beginners: https://kode.wiki/3MUhuve

© Copyright K odeK l oud


Fork
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
© Copyright K odeK l oud Check out our full course on GI T for Beginners: https://kode.wiki/3MUhuve
Check out our full course on GIT for Beginners: https://kode.wiki/3MUhuve

© Copyright K odeK l oud

You might also like