Git presentation

1,919 views

Published on

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,919
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
61
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Git presentation

  1. 1. whoami ?? Vikas S Yaligar @vikasyaligarhttps://github.com/vikassy
  2. 2. Why learn git??To manage your Project repository Sharing your code via github Contributing to others code
  3. 3. Contents➢ Git Introduction➢ Git Basic Commands➢ Git Branching & Merging➢ Github Introduction➢ Your app in Github➢ How to Contribute?
  4. 4. Git Is Open Source Version control System Tool for keeping a history on theDistributed Revision control state of your source codeSource code management projects.
  5. 5. Im an egotistical bastard,and I name all myprojects after myself. FirstLinux, now git Linus Torvalds
  6. 6. InstallationOn Linux sudo apt-get install git Version of gitOther systems git --version http://git-scm.com/
  7. 7. Git work flow
  8. 8. Git Basic Commandsgit init //initializes gitgit status //prints status of current repogit diff //prints difference made in filesgit add filename //adds file namegit commit -m “Message here :P” //saved!!git log //history
  9. 9. git initCreates a .git file in current folder Why??
  10. 10. BecauseTo tell git from where the file must be tracked !!!
  11. 11. git add To add particular files/folders to commitExamples:git add .git add test.cgit add somedirectory/file
  12. 12. How do I know which are added ? Using git status
  13. 13. git status Tells usabout untracked files and files added to commit How do i know what are the changes?
  14. 14. git diffTells the changes made in files
  15. 15. git commitgit commit -m “message here” -m => messagegit commit -am “message here:P”-a => To add the modified files and then commit Message is compulsory !!
  16. 16. git logTo show all commits with messages,check sum andmany more Checksum is always unique to each commit Can also use gitk, a commit viewer of git
  17. 17. How does it work??
  18. 18. .gitignoreTells git what to Ignore
  19. 19. Status & Review✔ Git Introduction✔ Git Basic Commands➢ Git Branching & Merging➢ Github Introduction➢ Your app in Github➢ How to Contribute?
  20. 20. Git Branching & Merginggit branch //Shows all branches of currrent repo
  21. 21. Git creating branchesGit branch branch_name
  22. 22. Commit in Branchgit checkout branch_name Goes to the branchgit add .git commit -am “Message”
  23. 23. Other optionsgit checkout -b branch_nameCreates new branch and goes to that branchgit branch -d branch nameDeletes the given branch
  24. 24. Merging git merge master branch_nameUsed to merge your work with master
  25. 25. After merging
  26. 26. Oh! I have to go back to last commit !!! How do I do that ???
  27. 27. git checkout checksum_number You will have same status as that commits data !!Concept: It goes to a no branch state, one canmake edits and also commit. But then you need tocreate that into new branch
  28. 28. Status & Review✔ Git Introduction✔ Git Basic Commands✔ Git Branching & Merging➢ Github Introduction➢ Your app in Github➢ How to Contribute?
  29. 29. Github
  30. 30. Who uses github ??? Many More !!!!
  31. 31. GitHub is the best way to collaborate with others. Fork, send pull requestsand manage all your public and private git repositories.
  32. 32. Creating a new repo
  33. 33. Git remoteA remote in Git is basically a way to tell Git whereanother version of your repository is. Then you can ask Git to fetch data from it that you don’t have yet, or push your commits up to it (if you have write access).Git remote add origin https://github.com/username/project.git
  34. 34. Fork a repo !!
  35. 35. Git clonegit clone new_repo_url your_nameCreates a repo by your_name
  36. 36. Adding upstreamgit remote add upstreamhttps://github.com/username/rep.git Adds remote named upstream for your current repo
  37. 37. Fetch git fetch upstreamFetches all the changes made to the original repo fromwhom you have forked
  38. 38. Merge Git merge upstream/masterMerges the upstream with master branch
  39. 39. Git pullDirectly pulls the update from the original repo to yourcurrent working repo
  40. 40. There is a lot more to be learnt Thank you !!● Credits:● 1)Chandramouli , 3rd year , BTech.● 2)Tushar Makkar , 2nd year, BTech.● 3)Pramati , 2nd year , BTech .

×