Git and fundamentals
-
Upload
naincy-gupta -
Category
Technology
-
view
183 -
download
1
Transcript of Git and fundamentals
![Page 1: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/1.jpg)
GIT Fundamentals & Features
Presenter: Naincy GuptaMindfire Solutions
![Page 2: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/2.jpg)
About Me Certifications:M70 101 - Magento Certified DeveloperOCA 870 - MYSQL
Contact Me: Email: [email protected]: mfsi_naincy.gupta
Connect Me: -Facebook : https://www.facebook.com/naincy.gupta.35574LinkedIn : in.linkedin.com/pub/naincy-gupta/66/440/6a3/Google+: https://plus.google.com/u/0/+NaincyGuptaTechSharing/postsBlog: http://[email protected]
![Page 3: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/3.jpg)
Contents GIT Types of VCS Basic Fundamentals GIT Usage Workflows of GIT GIT Stash Code Quality Why GIT make you happy?
![Page 4: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/4.jpg)
Git is nothing but a SCM tool. Git is a free and open source distributed version control
system designed to handle everything from small to very large projects with speed and efficiency.
Git is easy to learn and has a tiny footprint with lightning fast performance.
![Page 5: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/5.jpg)
![Page 6: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/6.jpg)
![Page 7: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/7.jpg)
Centralized Distributed
Central, authoritative repository Everyone has its own repository
All changes saved in one single location Get safety without having worry about 'breaking the build'
Client-Server approach One can change in repository and those changes will be local to them unless they synchronize with someone else.
![Page 8: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/8.jpg)
Is this true?
![Page 9: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/9.jpg)
![Page 10: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/10.jpg)
Start with GIT Install GIT client
- sudo apt-get install git (linux)
- brew install git (MAC)
Check if git is installed or not
$ git –version
Set username and email to your git config
$ git config --global user.name “Naincy”
$ git config --global user.email “[email protected]”
$ git config –list (will allow you to verify the username and email)
![Page 11: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/11.jpg)
GIT Fundamentals
Creating a repository (if it does not exist remotely)
$ git init (follow http://git-scm.com/docs/git-init for more information)
Cloning a remote repository:
$ git clone http[s]://host.xz[:port]/path/to/repo.git/
(Inspecting a repo: $ vim .git/config)
![Page 12: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/12.jpg)
Inspecting repo:
$ git status [Difference b/w index file and current head commit]
$ git log [Sow list of all commit with commit message]
$ git log -1 [Show top 1st commit]
$ git log - -pretty=oneline [Show list of all commit in single line]
![Page 13: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/13.jpg)
Branch Operations:
$ git branch <branch_name> OR git checkout -b <branch_name>
[will create new branch for you]
$ git branch -D <bramch_name> [allows you to delete branch]
$ git branch -m <old_branch_name> <new_branch_name> [will
remane the branch name from old to new]
$ git checkout <branch_name> [allows to switch to other branch]
$ git log - -pretty=oneline [Show list of all commit in single line]
![Page 14: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/14.jpg)
Making edit and commiting
$ git diff [will show delta difference code of current master HEAD and current index]
$ git status [will show path of file as “Changes not staged for commit”]
$ git add (-A) [will show file as “Changes to be commited”]
$ git commit -m [write your commit message. Save and exit] {file changed,
insertion, deletion}
Check your commit by $ git log
Send changes to server
$ git push <branch_name> [will push your all local changes to the server]
$ git pull <branch_name> [will pull all changes from server to your local]
![Page 15: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/15.jpg)
![Page 16: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/16.jpg)
Recover your changes that you have added by mistakes
$ git add <file name> [file <file name> that you have added by mistake]
$ git status
$ git reset HEAD <filename>
$ git checkout - - <filename>
Merge one branch to another
$ git merge branch2 [you are in branch 1 and merging branch2]
If you get conflicts, then can resolve with mergetool which provides a GUI interface to resolve
conflicts.
$ git mergetool
![Page 17: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/17.jpg)
GIT WorkFlows
![Page 18: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/18.jpg)
![Page 19: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/19.jpg)
![Page 20: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/20.jpg)
![Page 21: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/21.jpg)
GIT Stash
Will allow you to save your changes without commiting them
$ git stash save 'message' [save your change as a seperte stash@{*}
branch with commit message]
$ git stash list [will show you list of all stash with commit message]
$ git show <stash@{0}>
[will show you what code difference contain this this stash@{0}]
$ git apply <stash@{0}> [will allow to apply change in current branch]
![Page 22: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/22.jpg)
Code Quality
![Page 23: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/23.jpg)
![Page 24: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/24.jpg)
![Page 25: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/25.jpg)
![Page 26: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/26.jpg)
Fast and Compact
Freedom and Safety
Explore and Understand
Control and Assemble
Enforce Discipline: manages process by which control of items passes from one another.
Archive Version: can store subsequent versions of source control items. Also maintain lot of historical data like author, date, time, etc.
Enable Collaboration: easy sharing of files and docs Recover from accidental deletion: can easily swith to
working copy.
![Page 27: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/27.jpg)
![Page 29: Git and fundamentals](https://reader036.fdocuments.in/reader036/viewer/2022062822/588159e41a28ab80508b45c7/html5/thumbnails/29.jpg)
Thank You..!!