SlideShare a Scribd company logo
1 of 137
Download to read offline
Presented By S. M. Masoud Sadrnezhaad
Source: Michael Koby
Sharif University of Technology
Computer Engineering Department
CHAPTER 1
CHAPTER 2
Presented By S. M. Masoud Sadrnezhaad
Source: Michael Koby
Sharif University of Technology
Computer Engineering Department
Presented By S. M. Masoud Sadrnezhaad
Source: Michael Koby
Sharif University of Technology
Computer Engineering Department
CHAPTER 3
CHAPTER 4
Presented By S. M. Masoud Sadrnezhaad
Source: Michael Koby
Sharif University of Technology
Computer Engineering Department
Presented By S. M. Masoud Sadrnezhaad
Source: Michael Koby
Sharif University of Technology
Computer Engineering Department
CHAPTER 5
Sharif University of Technology
Computer Engineering Department
CHAPTER 6
Presented By S. M. Masoud Sadrnezhaad
Let's see in action
Initiate Git and It's Files
Working With Changes
# make a new directory and go to project path
> mkdir git_repo
> cd git_repo
# initialize git
> git init
Initialized empty Git repository in /path/to/git/repository/.git/
> ls -a
. .. .git
# let's have a deeper look at .git directory
> ls -a .git/
. .. branches config description HEAD hooks info objects refs
# define your name and email address (this config is per machine)
> git config --global user.name "Masoud Sadrnezhaad"
> git config --global user.email smmsadrnezh@gmail.com
# checkout your git config
> git config --list
user.name=Masoud Sadrnezhaad
user.email=smmsadrnezh@gmail.com
credential.helper=cache
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
# create and open README.md file with your default system editor.
> vi README.md
# let's write a readme file (with or witout markdown syntax)
# go to insert mode by click "I" one time
# and go back to command mode by Esc. save the file by "wq"
# make sure everything ok.
> ls -a
. .. .git README.md
# check modification and it's level (slide 62) you see modifications a
> git status
nothing added to commit but untracked files present (use "git add" to
# level up this file to staged level
> git add README.md
# look at git status. you see changes in staged level.
> git status
# add staged changes to new commit.
# write a meaningful message for your commit.
> git commit -m "added readme file"
[master (root-commit) 021bd57] commit message
0 files changed
create mode 100644 README
# look at git status. there is nothing to commit because changes
# are commited.
> git status
# let's take a look at created commits.
> git log
commit 021bd57955b472d8e6979ba71e4907e9f1e3ab8b
Author: Masoud Sadrnezhaad <smmsadrnezh@gmail.com>
Date: Fri May 1 02:12:46 2015 +0430
commti message
# final notes:
# it's easier to add and commit at once.
> git commit -am "commit message"
# this command add All files in your project directory
> git add -A
Undoing Things
# adding new modification to previous commits.
> git commit --amend
# you see commit message as it's name in first line.
# uncomment changes you want to ammend to that commit
# then save the file and close the editor.
# you see this modification in your last commit
> git log
# do some modification and stage them.
# now imagine that you want to unstage one of added files.
# to undo "git add"
> git reset HEAD README.md
# undo to last working version of that specific file.
> git checkout -- README.md
# undo to last working commit.
# actually this one reset everything not only one file.
> git reset --hard
HEAD is now at 11d075a commit message
Branching
# see list of all availeble branches.
> git branch
* master
# asterix indicates that HEAD is pointing to master branch.
# let's create a new branch and name it dev
> git branch dev
# HEAD is pointing to last commit of master branch likewise before.
> git branch
dev
* master
# change HEAD pointer to dev branch.
> git checkout dev
Switched to branch 'dev'
# do some modification and commit them.
> git commit -am "message"
[master 79635ac] message
1 file changed, 1 insertion(+)
# switch back to master branch.
> git checkout dev
Switched to branch 'dev'
# open recent changed files. changes does not apply becuz
# you are working on master branch and commited to dev branch.
# it's possible to create and switch to new branch at once.
> git checkout -b dev master
# master indicates that new branch is started from master.
# -b used to create it.
# to merge branch dev switch to branch you are going to merge with
> git checkout master
# now merge dev. this remove dev branch automatically
# but it keeps revision history (changelog)
> git merge dev
Remotes
# use .gitignore to indicate which files are not going to pushed
# into remote repository. you can put it everywhere in your project
# we use ! to exclude some files and dirs and * for all of them.
# use this command when you want to have a local copy
# from remote repository. --bare is used
> git clone --bare ~/git-repo/
# to clone from github
> git clone git@github.com:smmsadrnezh/repo-name.git
# to see centeral repository url you fetch from or push into
> git remote -v
origin https://github.com/smmsadrnezh/repo-name.git (fetch)
origin https://github.com/smmsadrnezh/repo-name.git (push)
# to push commits
> git push -u origin master
# typing "-u origin master" is only needed at first time.
# to get commits pushed by other collaborators.
# pull is equivalent to run fetch and merge one by one.
> git pull
# fetch get's commits but do'nt merge it.
# use diff command to see differences.
> git fetch origin
> git diff origin/master
# important note: pull everytime you want to push
# merge conflicts when using three way merge
Rebase
# rebasing branches is not a good idea
> git branch
> gitx
> git rebase master
Thank you :)

More Related Content

What's hot

Version control system & how to use git
Version control system & how to use git Version control system & how to use git
Version control system & how to use git Ahmed Dalatony
 
Introducción a Git
Introducción a GitIntroducción a Git
Introducción a GitJuan Antonio
 
Git (Sistema Distribuido de Control de Versiones)
Git (Sistema Distribuido de Control de Versiones)Git (Sistema Distribuido de Control de Versiones)
Git (Sistema Distribuido de Control de Versiones)TAWS
 
Cook like a Chef
Cook like a ChefCook like a Chef
Cook like a ChefIan Yang
 
Git learn from scratch
Git learn from scratchGit learn from scratch
Git learn from scratchMir Arif Hasan
 
Enjoy privacy on Gitlab
Enjoy privacy on GitlabEnjoy privacy on Gitlab
Enjoy privacy on GitlabMaxis Kao
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control SystemKMS Technology
 
Command cheatsheets windows
Command cheatsheets windowsCommand cheatsheets windows
Command cheatsheets windowsPaal Ringstad
 
Command cheatsheets mac
Command cheatsheets macCommand cheatsheets mac
Command cheatsheets macPaal Ringstad
 
Web Programming - Git basics
Web Programming - Git basicsWeb Programming - Git basics
Web Programming - Git basicsÖmer Taşkın
 
Git 101 Workshop
Git 101 WorkshopGit 101 Workshop
Git 101 WorkshopJoy Seng
 
Version Control Systems with git (and github) as an example
Version Control Systems with git (and github) as an exampleVersion Control Systems with git (and github) as an example
Version Control Systems with git (and github) as an exampleGaurav Kumar Garg
 
Atlanta Pm Git 101
Atlanta Pm Git 101Atlanta Pm Git 101
Atlanta Pm Git 101Jason Noble
 

What's hot (19)

Version control system & how to use git
Version control system & how to use git Version control system & how to use git
Version control system & how to use git
 
Introducción a Git
Introducción a GitIntroducción a Git
Introducción a Git
 
Git (Sistema Distribuido de Control de Versiones)
Git (Sistema Distribuido de Control de Versiones)Git (Sistema Distribuido de Control de Versiones)
Git (Sistema Distribuido de Control de Versiones)
 
Git in 5 Minutes
Git in 5 MinutesGit in 5 Minutes
Git in 5 Minutes
 
Git basics
Git basicsGit basics
Git basics
 
Cook like a Chef
Cook like a ChefCook like a Chef
Cook like a Chef
 
Git learn from scratch
Git learn from scratchGit learn from scratch
Git learn from scratch
 
Git cheat-sheet
Git cheat-sheetGit cheat-sheet
Git cheat-sheet
 
Git
GitGit
Git
 
Enjoy privacy on Gitlab
Enjoy privacy on GitlabEnjoy privacy on Gitlab
Enjoy privacy on Gitlab
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 
Command cheatsheets windows
Command cheatsheets windowsCommand cheatsheets windows
Command cheatsheets windows
 
Command cheatsheets mac
Command cheatsheets macCommand cheatsheets mac
Command cheatsheets mac
 
Web Programming - Git basics
Web Programming - Git basicsWeb Programming - Git basics
Web Programming - Git basics
 
Git 101 Workshop
Git 101 WorkshopGit 101 Workshop
Git 101 Workshop
 
Git github
Git githubGit github
Git github
 
Git commands
Git commandsGit commands
Git commands
 
Version Control Systems with git (and github) as an example
Version Control Systems with git (and github) as an exampleVersion Control Systems with git (and github) as an example
Version Control Systems with git (and github) as an example
 
Atlanta Pm Git 101
Atlanta Pm Git 101Atlanta Pm Git 101
Atlanta Pm Git 101
 

Viewers also liked (8)

Advancing the Art of Admissions through Science
Advancing the Art of Admissions through ScienceAdvancing the Art of Admissions through Science
Advancing the Art of Admissions through Science
 
Pure retail training presentation v2
Pure retail training presentation v2Pure retail training presentation v2
Pure retail training presentation v2
 
Delftware - At Your Service - Service Manager Dag - 17 maart 2016
Delftware - At Your Service - Service Manager Dag - 17 maart 2016Delftware - At Your Service - Service Manager Dag - 17 maart 2016
Delftware - At Your Service - Service Manager Dag - 17 maart 2016
 
Bai thuyet trinh11
Bai thuyet trinh11Bai thuyet trinh11
Bai thuyet trinh11
 
MM072015
MM072015MM072015
MM072015
 
CIVR2009 The Networked Archive
CIVR2009 The Networked ArchiveCIVR2009 The Networked Archive
CIVR2009 The Networked Archive
 
Akamai - Caspar Wiegel
Akamai - Caspar WiegelAkamai - Caspar Wiegel
Akamai - Caspar Wiegel
 
Cloud & connectiviteit - Proximus
Cloud & connectiviteit - ProximusCloud & connectiviteit - Proximus
Cloud & connectiviteit - Proximus
 

Similar to آموزش کار با GIT

Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlBecky Todd
 
Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHubLucas Videla
 
Get going with_git_ppt
Get going with_git_pptGet going with_git_ppt
Get going with_git_pptMiraz Al-Mamun
 
Lets Git Together
Lets Git TogetherLets Git Together
Lets Git TogetherRakesh Jha
 
Git Concepts, Commands and Connectivity
Git Concepts, Commands and ConnectivityGit Concepts, Commands and Connectivity
Git Concepts, Commands and ConnectivityRaja Soundaramourty
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about gitSothearin Ren
 
Source Code Management with Git
Source Code Management with GitSource Code Management with Git
Source Code Management with GitThings Lab
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptuallyseungzzang Kim
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践Terry Wang
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践Terry Wang
 
Git Basics (Professionals)
 Git Basics (Professionals) Git Basics (Professionals)
Git Basics (Professionals)bryanbibat
 

Similar to آموزش کار با GIT (20)

GIT Basics
GIT BasicsGIT Basics
GIT Basics
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Git cheat-sheet 2021
Git cheat-sheet 2021Git cheat-sheet 2021
Git cheat-sheet 2021
 
Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version control
 
Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHub
 
Get going with_git_ppt
Get going with_git_pptGet going with_git_ppt
Get going with_git_ppt
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
Lets Git Together
Lets Git TogetherLets Git Together
Lets Git Together
 
Git Concepts, Commands and Connectivity
Git Concepts, Commands and ConnectivityGit Concepts, Commands and Connectivity
Git Concepts, Commands and Connectivity
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
 
Source Code Management with Git
Source Code Management with GitSource Code Management with Git
Source Code Management with Git
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptually
 
Git training
Git trainingGit training
Git training
 
Git and github introduction
Git and github introductionGit and github introduction
Git and github introduction
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 
Git
GitGit
Git
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
 
Git Basics (Professionals)
 Git Basics (Professionals) Git Basics (Professionals)
Git Basics (Professionals)
 
Git
GitGit
Git
 

More from جشنوارهٔ روز آزادی نرم‌افزار تهران

More from جشنوارهٔ روز آزادی نرم‌افزار تهران (20)

Rights in CopyLeft
Rights in CopyLeftRights in CopyLeft
Rights in CopyLeft
 
Jekyll
JekyllJekyll
Jekyll
 
چرا اکثر ابررایانه‌ها از گنو/لینوکس استفاده می‌کنند؟
چرا اکثر ابررایانه‌ها از گنو/لینوکس استفاده می‌کنند؟چرا اکثر ابررایانه‌ها از گنو/لینوکس استفاده می‌کنند؟
چرا اکثر ابررایانه‌ها از گنو/لینوکس استفاده می‌کنند؟
 
StarCalendar
StarCalendarStarCalendar
StarCalendar
 
حرکت شتابدار به سوی دنیای Embedded System و نقش نرم‌افزارهای آزاد بر آن
حرکت شتابدار به سوی دنیای Embedded System و نقش نرم‌افزارهای آزاد بر آنحرکت شتابدار به سوی دنیای Embedded System و نقش نرم‌افزارهای آزاد بر آن
حرکت شتابدار به سوی دنیای Embedded System و نقش نرم‌افزارهای آزاد بر آن
 
خلاقیت و دانش آزاد؛ ظهور طبقه‌ای جدید در جامعه
خلاقیت و دانش آزاد؛ ظهور طبقه‌ای جدید در جامعهخلاقیت و دانش آزاد؛ ظهور طبقه‌ای جدید در جامعه
خلاقیت و دانش آزاد؛ ظهور طبقه‌ای جدید در جامعه
 
برنامهٔ آموزشی ویکی‌پدیا
برنامهٔ آموزشی ویکی‌پدیابرنامهٔ آموزشی ویکی‌پدیا
برنامهٔ آموزشی ویکی‌پدیا
 
چه هنگام نرم‌افزار آزاد به دام غیرآزاد می‌افتد؟
چه هنگام نرم‌افزار آزاد به دام غیرآزاد می‌افتد؟چه هنگام نرم‌افزار آزاد به دام غیرآزاد می‌افتد؟
چه هنگام نرم‌افزار آزاد به دام غیرآزاد می‌افتد؟
 
با سوزان آشنا شوید! (معرفی نرم افزار بلندر)
با سوزان آشنا شوید! (معرفی نرم افزار بلندر)با سوزان آشنا شوید! (معرفی نرم افزار بلندر)
با سوزان آشنا شوید! (معرفی نرم افزار بلندر)
 
آزادی و محرمانگی در رایانش همراه
آزادی و محرمانگی در رایانش همراهآزادی و محرمانگی در رایانش همراه
آزادی و محرمانگی در رایانش همراه
 
سیاست‌های کمتر شناخته‌شده ویکی‌پدیا
سیاست‌های کمتر شناخته‌شده ویکی‌پدیاسیاست‌های کمتر شناخته‌شده ویکی‌پدیا
سیاست‌های کمتر شناخته‌شده ویکی‌پدیا
 
معرفی بنیاد ویکی‌مدیا و پروژه‌هایش (به جز ویکی‌پدیا)
معرفی بنیاد ویکی‌مدیا و پروژه‌هایش (به جز ویکی‌پدیا)معرفی بنیاد ویکی‌مدیا و پروژه‌هایش (به جز ویکی‌پدیا)
معرفی بنیاد ویکی‌مدیا و پروژه‌هایش (به جز ویکی‌پدیا)
 
چرایی تغییر دیدگاه شرکت های انحصاری نسبت به نرم افزار آزاد
چرایی تغییر دیدگاه شرکت های انحصاری نسبت به نرم افزار آزادچرایی تغییر دیدگاه شرکت های انحصاری نسبت به نرم افزار آزاد
چرایی تغییر دیدگاه شرکت های انحصاری نسبت به نرم افزار آزاد
 
معرفی و ساخت یک فریم‌ورک شخصی به کمک لاراول
معرفی و ساخت یک فریم‌ورک شخصی به کمک لاراولمعرفی و ساخت یک فریم‌ورک شخصی به کمک لاراول
معرفی و ساخت یک فریم‌ورک شخصی به کمک لاراول
 
چگونگی ارسال packet در شبکه و مروری بر Wireshark
چگونگی ارسال packet در شبکه و مروری بر Wiresharkچگونگی ارسال packet در شبکه و مروری بر Wireshark
چگونگی ارسال packet در شبکه و مروری بر Wireshark
 
چگونگی ارسال packet در شبکه و مروری بر Wireshark
چگونگی ارسال packet در شبکه و مروری بر Wiresharkچگونگی ارسال packet در شبکه و مروری بر Wireshark
چگونگی ارسال packet در شبکه و مروری بر Wireshark
 
کار با اوپن‌استریت‌مپ (OSM) از مبتدی تا پیشرفته
کار با اوپن‌استریت‌مپ (OSM) از مبتدی تا پیشرفتهکار با اوپن‌استریت‌مپ (OSM) از مبتدی تا پیشرفته
کار با اوپن‌استریت‌مپ (OSM) از مبتدی تا پیشرفته
 
متاپست (MetaPost)
متاپست (MetaPost)متاپست (MetaPost)
متاپست (MetaPost)
 
داده‌کاوی و زبان برنامه‌نویسی R
داده‌کاوی و زبان برنامه‌نویسی Rداده‌کاوی و زبان برنامه‌نویسی R
داده‌کاوی و زبان برنامه‌نویسی R
 
یادگیری هک کلاه سفید و تست نفوذ به شبکه
یادگیری هک کلاه سفید و تست نفوذ به شبکهیادگیری هک کلاه سفید و تست نفوذ به شبکه
یادگیری هک کلاه سفید و تست نفوذ به شبکه
 

Recently uploaded

WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 

Recently uploaded (20)

WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 

آموزش کار با GIT

  • 1. Presented By S. M. Masoud Sadrnezhaad Source: Michael Koby Sharif University of Technology Computer Engineering Department CHAPTER 1
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48. CHAPTER 2 Presented By S. M. Masoud Sadrnezhaad Source: Michael Koby Sharif University of Technology Computer Engineering Department
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66. Presented By S. M. Masoud Sadrnezhaad Source: Michael Koby Sharif University of Technology Computer Engineering Department CHAPTER 3
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82. CHAPTER 4 Presented By S. M. Masoud Sadrnezhaad Source: Michael Koby Sharif University of Technology Computer Engineering Department
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105. Presented By S. M. Masoud Sadrnezhaad Source: Michael Koby Sharif University of Technology Computer Engineering Department CHAPTER 5
  • 106.
  • 107.
  • 108.
  • 109.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.
  • 118. Sharif University of Technology Computer Engineering Department CHAPTER 6 Presented By S. M. Masoud Sadrnezhaad Let's see in action
  • 119. Initiate Git and It's Files Working With Changes
  • 120. # make a new directory and go to project path > mkdir git_repo > cd git_repo # initialize git > git init Initialized empty Git repository in /path/to/git/repository/.git/ > ls -a . .. .git # let's have a deeper look at .git directory > ls -a .git/ . .. branches config description HEAD hooks info objects refs
  • 121. # define your name and email address (this config is per machine) > git config --global user.name "Masoud Sadrnezhaad" > git config --global user.email smmsadrnezh@gmail.com # checkout your git config > git config --list user.name=Masoud Sadrnezhaad user.email=smmsadrnezh@gmail.com credential.helper=cache core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true
  • 122. # create and open README.md file with your default system editor. > vi README.md # let's write a readme file (with or witout markdown syntax) # go to insert mode by click "I" one time # and go back to command mode by Esc. save the file by "wq" # make sure everything ok. > ls -a . .. .git README.md # check modification and it's level (slide 62) you see modifications a > git status nothing added to commit but untracked files present (use "git add" to
  • 123. # level up this file to staged level > git add README.md # look at git status. you see changes in staged level. > git status # add staged changes to new commit. # write a meaningful message for your commit. > git commit -m "added readme file" [master (root-commit) 021bd57] commit message 0 files changed create mode 100644 README # look at git status. there is nothing to commit because changes # are commited. > git status
  • 124. # let's take a look at created commits. > git log commit 021bd57955b472d8e6979ba71e4907e9f1e3ab8b Author: Masoud Sadrnezhaad <smmsadrnezh@gmail.com> Date: Fri May 1 02:12:46 2015 +0430 commti message # final notes: # it's easier to add and commit at once. > git commit -am "commit message" # this command add All files in your project directory > git add -A
  • 126. # adding new modification to previous commits. > git commit --amend # you see commit message as it's name in first line. # uncomment changes you want to ammend to that commit # then save the file and close the editor. # you see this modification in your last commit > git log
  • 127. # do some modification and stage them. # now imagine that you want to unstage one of added files. # to undo "git add" > git reset HEAD README.md # undo to last working version of that specific file. > git checkout -- README.md # undo to last working commit. # actually this one reset everything not only one file. > git reset --hard HEAD is now at 11d075a commit message
  • 129. # see list of all availeble branches. > git branch * master # asterix indicates that HEAD is pointing to master branch. # let's create a new branch and name it dev > git branch dev # HEAD is pointing to last commit of master branch likewise before. > git branch dev * master # change HEAD pointer to dev branch. > git checkout dev Switched to branch 'dev'
  • 130. # do some modification and commit them. > git commit -am "message" [master 79635ac] message 1 file changed, 1 insertion(+) # switch back to master branch. > git checkout dev Switched to branch 'dev' # open recent changed files. changes does not apply becuz # you are working on master branch and commited to dev branch. # it's possible to create and switch to new branch at once. > git checkout -b dev master # master indicates that new branch is started from master. # -b used to create it.
  • 131. # to merge branch dev switch to branch you are going to merge with > git checkout master # now merge dev. this remove dev branch automatically # but it keeps revision history (changelog) > git merge dev
  • 133. # use .gitignore to indicate which files are not going to pushed # into remote repository. you can put it everywhere in your project # we use ! to exclude some files and dirs and * for all of them. # use this command when you want to have a local copy # from remote repository. --bare is used > git clone --bare ~/git-repo/ # to clone from github > git clone git@github.com:smmsadrnezh/repo-name.git # to see centeral repository url you fetch from or push into > git remote -v origin https://github.com/smmsadrnezh/repo-name.git (fetch) origin https://github.com/smmsadrnezh/repo-name.git (push)
  • 134. # to push commits > git push -u origin master # typing "-u origin master" is only needed at first time. # to get commits pushed by other collaborators. # pull is equivalent to run fetch and merge one by one. > git pull # fetch get's commits but do'nt merge it. # use diff command to see differences. > git fetch origin > git diff origin/master # important note: pull everytime you want to push # merge conflicts when using three way merge
  • 135. Rebase
  • 136. # rebasing branches is not a good idea > git branch > gitx > git rebase master