Download - Github By Nyros Developer
![Page 1: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/1.jpg)
GIT
Global Information Tracking
![Page 2: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/2.jpg)
Contents
What is GIT? Why GIT? Normal Work flow? Branching / Merging? Why branching with GIT is awesome? Local and Remote operations Work flow with commandsSample screens
![Page 3: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/3.jpg)
What is GIT?
A popular distributed version control system designed to handle very large projects with speed and efficiency.
http://git.or.cz/
![Page 4: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/4.jpg)
Why GIT?
• Open source
• Easy to use and share your code efficiently
• Extremely fast, even with large projects
• Unlimited Repositories
• Unlimited branches
• Community
![Page 5: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/5.jpg)
![Page 6: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/6.jpg)
Staging files
. git add [file names]
• add all changed files to the staging area:
git add .
• these changes are NOT committed yet
![Page 7: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/7.jpg)
GIT staging area
• git has a concept of a ‘staging area’
• you first stage all of the changes that you
are happy with
• then you can commit the changes using commit command
![Page 8: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/8.jpg)
Committing
git commit -m “commit message”
Here commit message is used to track the cause for modifications in future.
![Page 9: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/9.jpg)
Branching / Merging
![Page 10: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/10.jpg)
Branching?
git branch
git branch [new branch name]
git checkout [new branch name]
![Page 11: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/11.jpg)
Merging?
git checkout [target branch]
git merge [other branch]
![Page 12: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/12.jpg)
Why branching and merging awesome?
Git will allow you to have multiple branches for each repository that can be entirely independent of each other and the creation, merging and deletion of those lines of development take seconds. Git makes this process incredibly easy and it changes the way most developers work when they learn it.
![Page 13: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/13.jpg)
Merging and Branching usage
$ git checkout -b test
$ git commit -am "Adding cutoff method to String"
$ git checkout master
Switched to branch "master"
$ git merge test
![Page 14: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/14.jpg)
Remote operations
git push [repository] [repository branch]
git pull [repository] [repository branch]
![Page 15: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/15.jpg)
Working with GIT?
First we have to create an account in http://www.github.com.
Login to github with your account details.
Create repository:
Goto Dashboard
New Repository
Give project name,description,homepageurl
Click on create repository.
![Page 16: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/16.jpg)
To Manage(Add,Modify,Remove files) in repository we need to have private,public keys.
Now check the keys in your system.
Open Git Bash
Type cd ~/.ssh
If you get dir not found error then you have to generate the keys.
Type ssh-keygen -t rsa -C "[email protected]"
Now your public key has been saved in /home/venkat/.ssh/id_rsa.pub
![Page 17: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/17.jpg)
Next steps
Global setup:
1. Download and install Git software
2. git config --global user.name "venkat"
3. git config --global user.email [email protected]
![Page 18: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/18.jpg)
Process
id_rsa is the private key and id_rsa_pub is the public key.
Goto Account settings -> SSH Public Keys -> Add another public key.
Enter title and key and press Add key.
Test whether it is correctly configured or not
$ ssh [email protected]
Hi venkatadapa! You've successfully authenticated,
![Page 19: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/19.jpg)
Local → Remote Submition
mkdir Appname
cd Appname
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin [email protected]:venkatadapa/Appname.git
git push origin master
![Page 20: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/20.jpg)
git add .
git commit -m “full application submitted”
git push origin master
Now all files in your application was submitted to remote repository
![Page 21: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/21.jpg)
Remote → Local →Remote
Git clone gitrepo_url [local_dirname]
Cd local_dirname
Change some files and add new files
Git add [filesnames]
add the modified files to repository
Git commit -m “cause for modifications”
Git push origin master
![Page 22: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/22.jpg)
TrackingGit –help
Git stash
No local changes to save
Git diff
will show you all modifications made on each file
Gti status
will show you any changes need to update into server
![Page 23: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/23.jpg)
Git log
Will show you all commit messages and commiters
![Page 24: Github By Nyros Developer](https://reader035.vdocuments.mx/reader035/viewer/2022081514/5549a1f4b4c905a6758b4ead/html5/thumbnails/24.jpg)
GOOD LUCK