Git 's way

98
#whoami Git Git’s way Muna A.H @abdimuna1 January 21, 2015 Muna A.H @abdimuna1 Git’s way

Transcript of Git 's way

Page 1: Git 's way

#whoamiGit

Git’s way

Muna A.H @abdimuna1

January 21, 2015

Muna A.H @abdimuna1 Git’s way

Page 2: Git 's way

#whoamiGit

Outline

1 #whoami

2 GitConfigsGit fundamentalsBranchingTagsstashesEnd

Muna A.H @abdimuna1 Git’s way

Page 3: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Me:

Name: @abdimuna1;From: DAR;Mcs: Informatic

∫& comp Engineering;

Day Job: AIMGROUP(T) a∫ ∫

enior Developer;Night Job: Independent

∫ecurity Researcher.

Muna A.H @abdimuna1 Git’s way

Page 4: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

What is Git

Git is a fast, scalable, distributed revision control system with anunusually rich command set that provides both high-leveloperations and full access to internals.

Muna A.H @abdimuna1 Git’s way

Page 5: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

What is Git . . .

|\ff150a7 | * | MAINTAINERS: ufs - remove self693373d | * | MAINTAINERS: change hpsa and cciss maintainere999dbc | * | Revert "block: all blk-mq requests are tagged"ae67479 | * | lib/scatterlist: fix memory leak with scsi-mq

|\ \ \| |\ \ \

74cfe07 | | * | | drm/exynos: correct connector->dpms field before resumingd6948b2 | | * | | drm/exynos: enable vblank after DPMS on3cb6830 | | * | | drm/exynos: init kms poll at the end of initializationc52142e | | * | | drm/exynos: init vblank with real number of crtcs

| |/ / /

Muna A.H @abdimuna1 Git’s way

Page 6: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Why Git ?

Git is extremly powerful tool if used fully!abdimuna

Few reasons for it:Speed

Simplicitynon-linear development, lightweight branchesFully distributed, this means every one can have acopy of of the repoCan handle large projects like Linux Kernel

Muna A.H @abdimuna1 Git’s way

Page 7: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Why Git ?

Git is extremly powerful tool if used fully!abdimuna

Few reasons for it:SpeedSimplicity

non-linear development, lightweight branchesFully distributed, this means every one can have acopy of of the repoCan handle large projects like Linux Kernel

Muna A.H @abdimuna1 Git’s way

Page 8: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Why Git ?

Git is extremly powerful tool if used fully!abdimuna

Few reasons for it:SpeedSimplicitynon-linear development, lightweight branches

Fully distributed, this means every one can have acopy of of the repoCan handle large projects like Linux Kernel

Muna A.H @abdimuna1 Git’s way

Page 9: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Why Git ?

Git is extremly powerful tool if used fully!abdimuna

Few reasons for it:SpeedSimplicitynon-linear development, lightweight branchesFully distributed, this means every one can have acopy of of the repo

Can handle large projects like Linux Kernel

Muna A.H @abdimuna1 Git’s way

Page 10: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Why Git ?

Git is extremly powerful tool if used fully!abdimuna

Few reasons for it:SpeedSimplicitynon-linear development, lightweight branchesFully distributed, this means every one can have acopy of of the repoCan handle large projects like Linux Kernel

Muna A.H @abdimuna1 Git’s way

Page 11: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Configurations

Types of configurations:- Local configurations

- Global configurations

Muna A.H @abdimuna1 Git’s way

Page 12: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Configurations

Types of configurations:- Local configurations- Global configurations

Muna A.H @abdimuna1 Git’s way

Page 13: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Local configurations

Is the type of config which is done per repo basis

Fore example to add a remote repositorygit remote add origin [email protected]/abdimuna/demo.gitNow you can pull or push from this demo repoTo view local configs, vim /.git/config/ within the repo [core]repositoryformatversion = 0filemode = truebare = falselogallrefupdates = trueremote "origin"url = [email protected]:abdimuna/demo.gitfetch = +refs/heads/*:refs/remotes/origin/*

Muna A.H @abdimuna1 Git’s way

Page 14: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Local configurations

Is the type of config which is done per repo basisFore example to add a remote repository

git remote add origin [email protected]/abdimuna/demo.gitNow you can pull or push from this demo repoTo view local configs, vim /.git/config/ within the repo [core]repositoryformatversion = 0filemode = truebare = falselogallrefupdates = trueremote "origin"url = [email protected]:abdimuna/demo.gitfetch = +refs/heads/*:refs/remotes/origin/*

Muna A.H @abdimuna1 Git’s way

Page 15: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Local configurations

Is the type of config which is done per repo basisFore example to add a remote repositorygit remote add origin [email protected]/abdimuna/demo.git

Now you can pull or push from this demo repoTo view local configs, vim /.git/config/ within the repo [core]repositoryformatversion = 0filemode = truebare = falselogallrefupdates = trueremote "origin"url = [email protected]:abdimuna/demo.gitfetch = +refs/heads/*:refs/remotes/origin/*

Muna A.H @abdimuna1 Git’s way

Page 16: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Local configurations

Is the type of config which is done per repo basisFore example to add a remote repositorygit remote add origin [email protected]/abdimuna/demo.gitNow you can pull or push from this demo repo

To view local configs, vim /.git/config/ within the repo [core]repositoryformatversion = 0filemode = truebare = falselogallrefupdates = trueremote "origin"url = [email protected]:abdimuna/demo.gitfetch = +refs/heads/*:refs/remotes/origin/*

Muna A.H @abdimuna1 Git’s way

Page 17: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Local configurations

Is the type of config which is done per repo basisFore example to add a remote repositorygit remote add origin [email protected]/abdimuna/demo.gitNow you can pull or push from this demo repoTo view local configs, vim /.git/config/ within the repo [core]repositoryformatversion = 0filemode = truebare = falselogallrefupdates = trueremote "origin"url = [email protected]:abdimuna/demo.gitfetch = +refs/heads/*:refs/remotes/origin/*

Muna A.H @abdimuna1 Git’s way

Page 18: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Global configurations

These are git configurations which are applied to all system-userlevel

Its good habit to place global configurations at$HOME/.gitconfig file

Components of the fileuser name = abdimuna

email = [email protected] ui = truehttp postBuffer = 524288000push default = current

Muna A.H @abdimuna1 Git’s way

Page 19: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Global configurations

These are git configurations which are applied to all system-userlevel

Its good habit to place global configurations at$HOME/.gitconfig fileComponents of the file

user name = abdimunaemail = [email protected]

color ui = truehttp postBuffer = 524288000push default = current

Muna A.H @abdimuna1 Git’s way

Page 20: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Global configurations

These are git configurations which are applied to all system-userlevel

Its good habit to place global configurations at$HOME/.gitconfig fileComponents of the file

user name = abdimunaemail = [email protected]

color ui = truehttp postBuffer = 524288000push default = current

Muna A.H @abdimuna1 Git’s way

Page 21: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Global configurations

These are git configurations which are applied to all system-userlevel

Its good habit to place global configurations at$HOME/.gitconfig fileComponents of the file

user name = abdimunaemail = [email protected]

color ui = true

http postBuffer = 524288000push default = current

Muna A.H @abdimuna1 Git’s way

Page 22: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Global configurations

These are git configurations which are applied to all system-userlevel

Its good habit to place global configurations at$HOME/.gitconfig fileComponents of the file

user name = abdimunaemail = [email protected]

color ui = truehttp postBuffer = 524288000

push default = current

Muna A.H @abdimuna1 Git’s way

Page 23: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Global configurations

These are git configurations which are applied to all system-userlevel

Its good habit to place global configurations at$HOME/.gitconfig fileComponents of the file

user name = abdimunaemail = [email protected]

color ui = truehttp postBuffer = 524288000push default = current

Muna A.H @abdimuna1 Git’s way

Page 24: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Global config. . .

core excludesfile = /Users/abdimuna/.gitignoreg lobaltrustctime = false

difftool "sourcetree" cmd = opendiff LOCAL¨¨REMOTEΞpath =

mergetool "sourcetree" cmd =/Applications/SourceTree.app/Contents/Resources/opendiff-w.shLOCAL¨¨REMOTEΞ

− ancestorΓBASEΞ−mergeΓMERGEDΞtrustExitCode = true

alias

Muna A.H @abdimuna1 Git’s way

Page 25: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Global config. . .

core excludesfile = /Users/abdimuna/.gitignoreg lobaltrustctime = false

difftool "sourcetree" cmd = opendiff LOCAL¨¨REMOTEΞpath =

mergetool "sourcetree" cmd =/Applications/SourceTree.app/Contents/Resources/opendiff-w.shLOCAL¨¨REMOTEΞ

− ancestorΓBASEΞ−mergeΓMERGEDΞtrustExitCode = true

alias

Muna A.H @abdimuna1 Git’s way

Page 26: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Global config. . .

core excludesfile = /Users/abdimuna/.gitignoreg lobaltrustctime = false

difftool "sourcetree" cmd = opendiff LOCAL¨¨REMOTEΞpath =

mergetool "sourcetree" cmd =/Applications/SourceTree.app/Contents/Resources/opendiff-w.shLOCAL¨¨REMOTEΞ

− ancestorΓBASEΞ−mergeΓMERGEDΞtrustExitCode = true

alias

Muna A.H @abdimuna1 Git’s way

Page 27: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Global config. . .

core excludesfile = /Users/abdimuna/.gitignoreg lobaltrustctime = false

difftool "sourcetree" cmd = opendiff LOCAL¨¨REMOTEΞpath =

mergetool "sourcetree" cmd =/Applications/SourceTree.app/Contents/Resources/opendiff-w.shLOCAL¨¨REMOTEΞ

− ancestorΓBASEΞ−mergeΓMERGEDΞtrustExitCode = true

alias

Muna A.H @abdimuna1 Git’s way

Page 28: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Global config . . .

Alternativelly you can use commandline to configure gitgit config –global user.name "Abdi Muna"

git config –global user.email "[email protected]"...for help git help config

Muna A.H @abdimuna1 Git’s way

Page 29: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Global config . . .

Alternativelly you can use commandline to configure gitgit config –global user.name "Abdi Muna"git config –global user.email "[email protected]"

...for help git help config

Muna A.H @abdimuna1 Git’s way

Page 30: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Global config . . .

Alternativelly you can use commandline to configure gitgit config –global user.name "Abdi Muna"git config –global user.email "[email protected]"...for help git help config

Muna A.H @abdimuna1 Git’s way

Page 31: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Initialization

cd /̃aim/my-talks/demo-git

touch README .txt

lsREADME.txt

git initInitialized empty Git repository in /my-talks/demog it/.git/

edit README.txtecho”workingongit” >> README .txt

Muna A.H @abdimuna1 Git’s way

Page 32: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Initialization

cd /̃aim/my-talks/demo-gittouch README .txt

lsREADME.txt

git initInitialized empty Git repository in /my-talks/demog it/.git/

edit README.txtecho”workingongit” >> README .txt

Muna A.H @abdimuna1 Git’s way

Page 33: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Initialization

cd /̃aim/my-talks/demo-gittouch README .txt

lsREADME.txt

git initInitialized empty Git repository in /my-talks/demog it/.git/

edit README.txtecho”workingongit” >> README .txt

Muna A.H @abdimuna1 Git’s way

Page 34: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Initialization

cd /̃aim/my-talks/demo-gittouch README .txt

lsREADME.txt

git initInitialized empty Git repository in /my-talks/demog it/.git/

edit README.txtecho”workingongit” >> README .txt

Muna A.H @abdimuna1 Git’s way

Page 35: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Initialization

cd /̃aim/my-talks/demo-gittouch README .txt

lsREADME.txt

git initInitialized empty Git repository in /my-talks/demog it/.git/

edit README.txtecho”workingongit” >> README .txt

Muna A.H @abdimuna1 Git’s way

Page 36: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Staging

Is the process of adding files to be tracked by git

git add README.txtAfter adding file/s, check status by:git statusOn branch masterInitial commitUntracked files:(use "git add <file>..." to include in what will be committed)README.txtnothing added to commit but untracked files present (use "gitadd" to track)

Muna A.H @abdimuna1 Git’s way

Page 37: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Staging

Is the process of adding files to be tracked by gitgit add README.txt

After adding file/s, check status by:git statusOn branch masterInitial commitUntracked files:(use "git add <file>..." to include in what will be committed)README.txtnothing added to commit but untracked files present (use "gitadd" to track)

Muna A.H @abdimuna1 Git’s way

Page 38: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Staging

Is the process of adding files to be tracked by gitgit add README.txtAfter adding file/s, check status by:

git statusOn branch masterInitial commitUntracked files:(use "git add <file>..." to include in what will be committed)README.txtnothing added to commit but untracked files present (use "gitadd" to track)

Muna A.H @abdimuna1 Git’s way

Page 39: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Staging

Is the process of adding files to be tracked by gitgit add README.txtAfter adding file/s, check status by:git statusOn branch masterInitial commitUntracked files:(use "git add <file>..." to include in what will be committed)README.txtnothing added to commit but untracked files present (use "gitadd" to track)

Muna A.H @abdimuna1 Git’s way

Page 40: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Commiting

Commit Is the process of recording changes to a repositoryTo Commit to a run command

git commit -am "My commit message"master (root-commit) 492f203 added readme

1 file changed, 0 insertions(+), 0 deletions(-)create mode 100644 REDME.txtTo check status again:git statusOn branch masternothing to commit, working directory clean

Muna A.H @abdimuna1 Git’s way

Page 41: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Commiting

Commit Is the process of recording changes to a repositoryTo Commit to a run commandgit commit -am "My commit message"

master (root-commit) 492f203 added readme1 file changed, 0 insertions(+), 0 deletions(-)create mode 100644 REDME.txtTo check status again:git statusOn branch masternothing to commit, working directory clean

Muna A.H @abdimuna1 Git’s way

Page 42: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Commiting

Commit Is the process of recording changes to a repositoryTo Commit to a run commandgit commit -am "My commit message"

master (root-commit) 492f203 added readme1 file changed, 0 insertions(+), 0 deletions(-)create mode 100644 REDME.txt

To check status again:git statusOn branch masternothing to commit, working directory clean

Muna A.H @abdimuna1 Git’s way

Page 43: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Commiting

Commit Is the process of recording changes to a repositoryTo Commit to a run commandgit commit -am "My commit message"

master (root-commit) 492f203 added readme1 file changed, 0 insertions(+), 0 deletions(-)create mode 100644 REDME.txtTo check status again:

git statusOn branch masternothing to commit, working directory clean

Muna A.H @abdimuna1 Git’s way

Page 44: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Commiting

Commit Is the process of recording changes to a repositoryTo Commit to a run commandgit commit -am "My commit message"

master (root-commit) 492f203 added readme1 file changed, 0 insertions(+), 0 deletions(-)create mode 100644 REDME.txtTo check status again:git statusOn branch masternothing to commit, working directory clean

Muna A.H @abdimuna1 Git’s way

Page 45: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Commiting . . .

Hints about commits:make few changes

one change per commitdon’t do massive changes over the sundays, and commits onmondaywrite short good commit message, "fixed semicolon bug"

Muna A.H @abdimuna1 Git’s way

Page 46: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Commiting . . .

Hints about commits:make few changesone change per commit

don’t do massive changes over the sundays, and commits onmondaywrite short good commit message, "fixed semicolon bug"

Muna A.H @abdimuna1 Git’s way

Page 47: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Commiting . . .

Hints about commits:make few changesone change per commitdon’t do massive changes over the sundays, and commits onmonday

write short good commit message, "fixed semicolon bug"

Muna A.H @abdimuna1 Git’s way

Page 48: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Commiting . . .

Hints about commits:make few changesone change per commitdon’t do massive changes over the sundays, and commits onmondaywrite short good commit message, "fixed semicolon bug"

Muna A.H @abdimuna1 Git’s way

Page 49: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Reverting a commit

Suppose you made a mistake, and want to go back to previous state

git reset --had HEAD

this will delete the last current commit and go back to a commit b4it.

Note: these changes are irreversible, be warned

Muna A.H @abdimuna1 Git’s way

Page 50: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Reverting a commit

Suppose you made a mistake, and want to go back to previous state

git reset --had HEAD

this will delete the last current commit and go back to a commit b4it.Note: these changes are irreversible, be warned

Muna A.H @abdimuna1 Git’s way

Page 51: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Time machine, go back in time

Suppose you want to go back to a specific commit history,

git checkout <SHA-1-hash-value>

where SHA-1 is the commit hash

Muna A.H @abdimuna1 Git’s way

Page 52: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Logging

Is the way of showing commit messages git log [<options>][<revision range>] [[–] <path>. . . ]by default log lists

checksum

author’s name and emaildate writtencommit message

Muna A.H @abdimuna1 Git’s way

Page 53: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Logging

Is the way of showing commit messages git log [<options>][<revision range>] [[–] <path>. . . ]by default log lists

checksumauthor’s name and email

date writtencommit message

Muna A.H @abdimuna1 Git’s way

Page 54: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Logging

Is the way of showing commit messages git log [<options>][<revision range>] [[–] <path>. . . ]by default log lists

checksumauthor’s name and emaildate written

commit message

Muna A.H @abdimuna1 Git’s way

Page 55: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Logging

Is the way of showing commit messages git log [<options>][<revision range>] [[–] <path>. . . ]by default log lists

checksumauthor’s name and emaildate writtencommit message

Muna A.H @abdimuna1 Git’s way

Page 56: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Logging. . .

Log options-p -2 shows the diff introduced in each commit, limit output tolast 2 entries

–stat for showing abbreviated stats for each commit–pretty for formatting the ouput e.e –pretty=oneline

Muna A.H @abdimuna1 Git’s way

Page 57: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Logging. . .

Log options-p -2 shows the diff introduced in each commit, limit output tolast 2 entries–stat for showing abbreviated stats for each commit

–pretty for formatting the ouput e.e –pretty=oneline

Muna A.H @abdimuna1 Git’s way

Page 58: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Logging. . .

Log options-p -2 shows the diff introduced in each commit, limit output tolast 2 entries–stat for showing abbreviated stats for each commit–pretty for formatting the ouput e.e –pretty=oneline

Muna A.H @abdimuna1 Git’s way

Page 59: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Loggin. . .

You can view complex view like

git log --since=10.weeks

This show commits made in last 10 weeksDate: Thu Dec 4 14:41:04 2014 +0300monthly submissions within a yearcommit 452709b78219b7a428fdf6b1adf8dfcd1081427dAuthor: abdimuna <[email protected]>Date: Thu Dec 4 14:08:30 2014 +0300twelve month submissionscommit 3fe1fa6b2ede1b1ad85d69df21616558608513e4Author: abdimuna <[email protected]>Date: Thu Dec 4 11:25:53 2014 +0300added the by month graph

Muna A.H @abdimuna1 Git’s way

Page 60: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Loggin. . .

You can view complex view like

git log --since=10.weeks

This show commits made in last 10 weeksDate: Thu Dec 4 14:41:04 2014 +0300monthly submissions within a yearcommit 452709b78219b7a428fdf6b1adf8dfcd1081427dAuthor: abdimuna <[email protected]>Date: Thu Dec 4 14:08:30 2014 +0300twelve month submissionscommit 3fe1fa6b2ede1b1ad85d69df21616558608513e4Author: abdimuna <[email protected]>Date: Thu Dec 4 11:25:53 2014 +0300added the by month graph

Muna A.H @abdimuna1 Git’s way

Page 61: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Loggin. . .

Table: Log options

Option-(n)–since, –after–until, –before–author–committer

Muna A.H @abdimuna1 Git’s way

Page 62: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Branching

Is the way of spliting your project as multiple separate work-flowentitiesFore example you can have diffent branches:master develop featuer bug

Muna A.H @abdimuna1 Git’s way

Page 63: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Branches in a nut shell

| |/ / /d34d4d8 | * | | Merge branch ’drm-fixes-3.18’ of git://people.freedesktop.org/~agd5f/linux into drm-fixes

| |\ \ \072c44b | | * | | drm/radeon: remove some buggy dead code8c3e434 | | * | | drm/radeon: remove invalid pci id72b3f91 | | * | | drm/radeon: dpm fixes for asrock systemsc9cb57f | | * | | radeon: clean up coding style differences in radeon_get_bios()e5a5fd4 | | * | | drm/radeon: Use drm_malloc_ab instead of kmalloc_array6fa4559 | | * | | drm/radeon/dpm: disable ulv support on SI

| |\ \ \ \

Muna A.H @abdimuna1 Git’s way

Page 64: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Local branching

By default git init creates a master repository in your project Youcan

Create a new branchdelete a branchview branchespull from a branchmerge a branches

Muna A.H @abdimuna1 Git’s way

Page 65: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Local branching

By default git init creates a master repository in your project Youcan

Create a new branch

delete a branchview branchespull from a branchmerge a branches

Muna A.H @abdimuna1 Git’s way

Page 66: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Local branching

By default git init creates a master repository in your project Youcan

Create a new branchdelete a branch

view branchespull from a branchmerge a branches

Muna A.H @abdimuna1 Git’s way

Page 67: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Local branching

By default git init creates a master repository in your project Youcan

Create a new branchdelete a branchview branches

pull from a branchmerge a branches

Muna A.H @abdimuna1 Git’s way

Page 68: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Local branching

By default git init creates a master repository in your project Youcan

Create a new branchdelete a branchview branchespull from a branch

merge a branches

Muna A.H @abdimuna1 Git’s way

Page 69: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Local branching

By default git init creates a master repository in your project Youcan

Create a new branchdelete a branchview branchespull from a branchmerge a branches

Muna A.H @abdimuna1 Git’s way

Page 70: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

creating a branch

simple !git branch <myBranchName>

To work on that branchgit checkout <myBranchName>go back to other branchgit checkout <myOtherBranchName>

Muna A.H @abdimuna1 Git’s way

Page 71: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

creating a branch

simple !git branch <myBranchName>To work on that branchgit checkout <myBranchName>

go back to other branchgit checkout <myOtherBranchName>

Muna A.H @abdimuna1 Git’s way

Page 72: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

creating a branch

simple !git branch <myBranchName>To work on that branchgit checkout <myBranchName>go back to other branchgit checkout <myOtherBranchName>

Muna A.H @abdimuna1 Git’s way

Page 73: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

deleting

to delete a branch

git branch -d <branchNameToDelete>

Muna A.H @abdimuna1 Git’s way

Page 74: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

viewing

to view all branches

git branch -v

Muna A.H @abdimuna1 Git’s way

Page 75: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

pull

pulling from a remote specific branchgit pull remote origin:<myBranchName>

Muna A.H @abdimuna1 Git’s way

Page 76: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

merge

merging from a remote branch

git merge remote origin:<branchNameToMerge>

Muna A.H @abdimuna1 Git’s way

Page 77: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

remote branching

Are extremly useful when it comes to

storing you project as backupcollaboration with friends, or co-workers

Muna A.H @abdimuna1 Git’s way

Page 78: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

remote branching

Are extremly useful when it comes tostoring you project as backup

collaboration with friends, or co-workers

Muna A.H @abdimuna1 Git’s way

Page 79: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

remote branching

Are extremly useful when it comes tostoring you project as backupcollaboration with friends, or co-workers

Muna A.H @abdimuna1 Git’s way

Page 80: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

remote branching. . .

To add a remote branch to your project aka repo

remote add origin <url-containing-repo>exampleremote add origin [email protected]/git-demo.git

Muna A.H @abdimuna1 Git’s way

Page 81: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

remote branching. . .

To add a remote branch to your project aka reporemote add origin <url-containing-repo>

exampleremote add origin [email protected]/git-demo.git

Muna A.H @abdimuna1 Git’s way

Page 82: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

remote branching. . .

To add a remote branch to your project aka reporemote add origin <url-containing-repo>exampleremote add origin [email protected]/git-demo.git

Muna A.H @abdimuna1 Git’s way

Page 83: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

viewing remote

to view list of remote repos currently in your project

git remote -v

Muna A.H @abdimuna1 Git’s way

Page 84: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

deleting remote

to delete a remote branch

git remote origin:delete-me-branch -d

Muna A.H @abdimuna1 Git’s way

Page 85: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

pulling

to pull from a remote specific branchgit pull origin:<remoteBranchNameToPull>

Muna A.H @abdimuna1 Git’s way

Page 86: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

merging

to merge files on your working project to that of remotegit merge origin:<remoteBranchNameToMerge>

Muna A.H @abdimuna1 Git’s way

Page 87: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Tags

Tags are very useful\ when it comes to

marking your project for certain release like v1.0.0marking your certain critical changes or features

Muna A.H @abdimuna1 Git’s way

Page 88: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Tags

Tags are very useful\ when it comes tomarking your project for certain release like v1.0.0

marking your certain critical changes or features

Muna A.H @abdimuna1 Git’s way

Page 89: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

Tags

Tags are very useful\ when it comes tomarking your project for certain release like v1.0.0marking your certain critical changes or features

Muna A.H @abdimuna1 Git’s way

Page 90: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

creating tags

To create a tag

git tag -a v1.0.0 -m "My first stable app release"

-a is for anotation-m for message

By default, tags are not pushed to a remote repository

Muna A.H @abdimuna1 Git’s way

Page 91: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

creating tags

To create a tag

git tag -a v1.0.0 -m "My first stable app release"

-a is for anotation

-m for message

By default, tags are not pushed to a remote repository

Muna A.H @abdimuna1 Git’s way

Page 92: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

creating tags

To create a tag

git tag -a v1.0.0 -m "My first stable app release"

-a is for anotation-m for message

By default, tags are not pushed to a remote repository

Muna A.H @abdimuna1 Git’s way

Page 93: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

viewing tags

To view tags in your repogit tag show

Muna A.H @abdimuna1 Git’s way

Page 94: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

creating stashes

I won’t talk much about this but !\ its useful when you want to

experimenting a new feature and don’t walk away from yourbranchyou are on the phone, and your boss is inviting you for quickmeetinganyting which can disrupt you from currently workingsituation, like leaving your editor for a while

Muna A.H @abdimuna1 Git’s way

Page 95: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

creating stashes

I won’t talk much about this but !\ its useful when you want to

experimenting a new feature and don’t walk away from yourbranch

you are on the phone, and your boss is inviting you for quickmeetinganyting which can disrupt you from currently workingsituation, like leaving your editor for a while

Muna A.H @abdimuna1 Git’s way

Page 96: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

creating stashes

I won’t talk much about this but !\ its useful when you want to

experimenting a new feature and don’t walk away from yourbranchyou are on the phone, and your boss is inviting you for quickmeeting

anyting which can disrupt you from currently workingsituation, like leaving your editor for a while

Muna A.H @abdimuna1 Git’s way

Page 97: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

creating stashes

I won’t talk much about this but !\ its useful when you want to

experimenting a new feature and don’t walk away from yourbranchyou are on the phone, and your boss is inviting you for quickmeetinganyting which can disrupt you from currently workingsituation, like leaving your editor for a while

Muna A.H @abdimuna1 Git’s way

Page 98: Git 's way

#whoamiGit

ConfigsGit fundamentalsBranchingTagsstashesEnd

outro

. . . Q/A, & #∫(happycoding)dt

Muna A.H @abdimuna1 Git’s way