├── CONTRIBUTING.md ├── Git-for-geek.md ├── README.md └── basics-of-github.md /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | Star this repository. 3 | Fork this repository. 4 | Clone the forked repository to your local machine. ( git clone ) 5 | Add your name and profile link in README.md file. ( Open the file using any text editor ) 6 | Commit the message and put your Name as commit message. ( git add . & git commit -m "Your Name here" ) 7 | Push the changes. ( git push origin master ) 8 | Create a pull request. 9 | -------------------------------------------------------------------------------- /Git-for-geek.md: -------------------------------------------------------------------------------- 1 | ### Basics of Git 2 | ``` 3 | 4 | git help config 5 | git config --global user.name 'Dibyendu' 6 | git init ( Initialize an empty repository ) 7 | git add *.txt 8 | git status ( See your status ) 9 | git commit -m "Commit Messages" ( Make a commit to files which are in staging area) 10 | git log ( to see the commit history) 11 | 12 | ``` 13 | ### Adding files for staging 14 | ``` 15 | 16 | git add . ( Adds everything ) 17 | git add a.txt b.txt ( add files selectively ) 18 | git add --all ( Add all files ) 19 | git add /*.txt ( Add all *.txt files in current Diretory) 20 | git add docs/*.txt ( Add all the *.txt files in the docs dirctory 21 | git add "*.txt" Add all *.txt files in the whole project 22 | 23 | ``` 24 | ### Staging 25 | ``` 26 | 27 | git diff ( Show unstaged difference since last commit) 28 | git add *.txt 29 | git diff ( No difference after files are staged ) 30 | git diff --staged ( View staged difference) 31 | git reset HEAD Somefile ( To remove from a staged area ; HEAD refers to last commit on the timeline) 32 | git checkout -- FileName ( reomove all the changes made to the file since last commit) 33 | git commit -a -m "Change" ( Skip staging and commit direclty. Add changes from all traced files only. Untraced files are not added) 34 | git reset --soft HEAD^ - (Undoing commit and reset into staging [^ Move one commit before HEAD] ) 35 | git add todo.txt 36 | git commit --amend -m "Some message" ( Add to last commit. Overwrite last commit. Whatever has been staged is added to last commit) 37 | git reset --hard HEAD^ ( Undo last commit and all the changes) 38 | git reset --hard HEAD^^ (Undo last 2 commit and all the changes) 39 | 40 | ``` 41 | ### Remotes 42 | ``` 43 | 44 | git remote add origin https://github.com/dibsy/git-cheatsheet.git ( Adding a remote ) 45 | git remote -v ( List all available remote repository ) 46 | git push -u origin master ( Push to origin our master branch ) 47 | git pull ( pull changes from remote ) 48 | git remote add
( Add remotes) 49 | git remote rm ( To remove remotes ) 50 | git push -u ( push to remote any branch. Useful in when there are mutliple remotes) 51 | 52 | ``` 53 | ### Cloning 54 | ``` 55 | 56 | git clone https://github.com/dibsy/git-cheatsheet.git ( Clone a remote repository. Add origin remote pointing to clone URL) 57 | git clone https://github.com/dibsy/git-cheatsheet.git my-repo ( Will be stored in my-repo directory ) 58 | 59 | ``` 60 | ### Branching 61 | ``` 62 | 63 | git branch new_branch ( Create a new branch ) 64 | git checkout new_branch ( Switching to the branch_name ) 65 | git checkout master ( Move back to master branch ) 66 | git merge new_branch ( Merge the contents of new_branch in master ) 67 | git branch -d new_branch ( Delete the branch ) 68 | git checkout -b admin ( Fast forward technique. Creates and checksout branch) 69 | 70 | Scennario Based - Creating local branch and sending it to remote 71 | git checkout -b mybranch ( Create and checkout local branch) 72 | git push origin mybranch ( Push local branch to remote) 73 | git add cart.rb ( Add the new files) 74 | git commit -a -m "Some message" ( Commit ) 75 | git push ( pushed to mybranch) ( Push ) 76 | 77 | ``` 78 | ### Merging Changes (Push/pull) 79 | ``` 80 | 81 | Incase the remote commit is ahead of local copy but on different files 82 | git push ( Will throw error) 83 | git pull ( Do git pull first) 84 | git push 85 | 86 | Incase the remote commit is ahead of local copy but on same files 87 | git pull ( error ) 88 | git status 89 | edit the file 90 | git add file.txt 91 | git commit -a 92 | 93 | ``` 94 | ### Diff 95 | ``` 96 | 97 | git diff ( see the changes made in files) 98 | git diff HEAD^ ( diff with the parent of the latest commit) 99 | git diff HEAD^^ ( diff with the grandparent of the latest commit) 100 | git diff master branchname ( diff two branches ) 101 | git diff --staged ( show changes of staging area ) 102 | 103 | ``` 104 | ### Tagging 105 | ``` 106 | 107 | git tag ( List all the tags ) 108 | git checkout v0.1 ( checkout the commit ) 109 | git tag -a v0.2.1 -m "New changes in v0.2.1" 110 | git push --tags ( Push the tags to remote ) 111 | 112 | ``` 113 | ### Removing 114 | ``` 115 | 116 | git rm file.txt 117 | git commit -m "Removing file.txt" 118 | 119 | ``` 120 | ### Untracking 121 | ``` 122 | 123 | Untracking File 124 | git rm --cached somefileToUntrack.txt 125 | 126 | ``` 127 | ### Aliasing 128 | ``` 129 | 130 | git config alias.myaliasshorcutcommand commit 131 | 132 | 133 | ``` 134 | ### Blame 135 | ``` 136 | git blame somefile.txt ( see who made the changes and other details of the changes) 137 | 138 | ``` 139 | 140 | ### Logging 141 | ``` 142 | git log --pretty=oneline ( show logs in one line) 143 | git log --abrev-commit (abbreviate the hashes) 144 | git log --stat ( show commits static ) 145 | git log -p -4 ( show changes of the last 4 commits ) 146 | ``` 147 | 148 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Practice Git 2 | 3 | Create a account on GitHub or Use your current account for this Activity. 4 | 5 | ![Header Image](https://3.bp.blogspot.com/-saxzerGz11k/VvwDXIFsaXI/AAAAAAAADHA/DLcRkrwzAYohcsEjl_IaEke5bc6EJo0LA/s1600/github-mark.png) 6 | 7 | # Tasks to do 8 | 9 | 1. Star this repository. 10 | 2. Fork this repository. 11 | 3. Clone the forked repository to your local machine. ( git clone ) 12 | 4. Add your name and profile link in README.md file. ( Open the file using any text editor ) 13 | 5. Commit the message and put your Name as commit message. ( git add . & git commit -m "Your Name here" ) 14 | 6. Push the changes online. ( git push origin master ) 15 | 7. Come back here and click on pull request tab and create a pull request. 16 | 17 | ![Image](https://static.vecteezy.com/system/resources/previews/000/400/849/non_2x/people-making-a-to-do-list-illustration-vector.jpg) 18 | 19 | # Reference 20 | 21 | 1. [15 Minutes Tutorial](https://try.github.io/levels/1/challenges/1) 22 | 2. [Commands Cheatsheet](https://services.github.com/on-demand/downloads/github-git-cheat-sheet.pdf) 23 | 24 | # Add your Profile Link here 25 | 26 | ## Use this Format 27 | 28 | ## S.No. [Your Name Here] (Link to Your Profile here) 29 | 30 | 1. [Sanjeev](https://github.com/thedevelopersanjeev) 31 | 2. [Aman](https://github.com/A-manSingh) 32 | 3. [Komal](https://github.com/Komalchhoker) 33 | 4. [Palak](https://github.com/PalakSharmaa) 34 | 5. [Anamika](https://github.com/AnamikaSaxena17) 35 | 6. [Shivpal](https://github.com/shivpalsinghnext) 36 | 7. [Apoorv](https://github.com/1998apoorvmalik) 37 | 8. [Sandeep](https://github.com/Sandeep1rok) 38 | 9. [Kunal Ahlawat](https://github.com/newkunal) 39 | 10. [Renu](https://github.com/Renukumari13) 40 | 11. [Sakshi](https://github.com/Sakshi2706) 41 | 12. [Kiran](https://github.com/kiran1720) 42 | 13. [Rajnikant](https://github.com/rajnikant88) 43 | 14. [Ajay Yadav](https://github.com/Ajayyadav0299) 44 | 15. [Chetna](https://github.com/sainichetna) 45 | 16. [BabliKiran](https://github.com/BabliKiran) 46 | 17. [Abhishek](https://github.com/iamabhi443) 47 | 18. [Gaurav Nigam](https://github.com/gauravnigam37) 48 | 19. [Jyoti Pandey](https://github.com/jyotipandey45) 49 | 20. [Deepanshu Saini](https://github.com/deepanshusaini81) 50 | 21. [Kashish Dhawan](https://github.com/Smoke0) 51 | 22. [Prabhat](https://github.com/Prabhat98) 52 | 23. [Himanshu Pathak](https://github.com/pathakhimanshu) 53 | 24. [Tamanna Sharma](https://github.com/tamanna43) 54 | 25. [Savita](https://github.com/Savitakaushik) 55 | 26. [Sapna](https://github.com/SapnaMathur) 56 | 27. [Ketan Aggarwal](https://github.com/ketan5544) 57 | 28. [Ravi Kumar](https://github.com/Ravikumar23) 58 | 29. [Abhishek Kush](https://github.com/kushabhi) 59 | 30. [Vipul Verma](https://github.com/thedevelopervipul) 60 | 31. [Yash Kalra](https://github.com/Yash-Kalra) 61 | 32. [Aman Kumar](https://github.com/Amankumar1997) 62 | 33. [Shubham Sharma](https://github.com/shubhamsharmadvlpr) 63 | 34. [Aakash Kumar](https://github.com/aakash-kumar27) 64 | 35. [Bhani Ram](https://github.com/bhanukh) 65 | 36. [Shubham Yadav](https://github.com/yadavshubham2199) 66 | 37. [Ritika](https://github.com/ritikakaushik) 67 | 38. [Abhishek Vikrant](https://github.com/AbhishekVikrant) 68 | 39. [Narender](https://github.com/narender22) 69 | 40. [Anjali Yadav](https://github.com/Shabojoly) 70 | 41. [Aarti Joshi](https://github.com/aarti95) 71 | 42. [Akshay](https://github.com/Akshay201318) 72 | 43. [Shubham Tiwari](https://github.com/ShubhamTiwari11) 73 | 44. [Ajay Kaushik](https://github.com/ajaykaushiksharma) 74 | 45. [Harshit](https://github.com/hsharshit13) 75 | 46. [Ajay Rathi](https://github.com/ajay3897) 76 | 47. [Chandan Kumar](https://github.com/ck96548) 77 | 48. [Amit Sharma](https://github.com/amidixita) 78 | 49. [vanshika Mehta](https://github.com/mvanshikamehta17521) 79 | 50. [Arti Dalal](https://github.com/adalal1999) 80 | 51. [Annu Kumari](https://github.com/annu97) 81 | 52. [Rekha Kadian](https://github.com/rekha7896) 82 | 53. [Priya Kumari](https://github.com/priya17507) 83 | 54. [Nidhi Lor](https://github.com/nidhilor) 84 | 55. [Arman Malik](https://github.com/armanmalikar) 85 | 56. [Dhiraj Kaushik](https://github.com/dhirajkaushik321) 86 | 57. [Shivam](https://github.com/Shivampm123) 87 | 58. [Sagar](https://github.com/sagarpatel288) 88 | 59. [Hikky](https://github.com/Hikkygaya) 89 | 60. [Sana](https://github.com/quicksilver28) 90 | 61. [Sayantan](https://github.com/sayantanHack) 91 | 62. [Gaurav](https://github.com/msgaurav) 92 | 63. [Ajay S. Rawat](https://github.com/ajayrwt34) 93 | 64. [Tarun Jindal](https://github.com/tarunjindal790) 94 | 65. [Damian Sire](https://github.com/damiansire) 95 | 66. [Arendt](https://github.com/Arendt) 96 | 67. [William](https://github.com/williamxz) 97 | 68. [Moh. Wahyu S. Putra](https://github.com/way) 98 | 69. [Jonathan Lozada](https://github.com/jlozadad) 99 | 70. [Vanessa](https://github.com/vanessa) 100 | 71. [Gibran Khrisna Putra](https://github.com/brantem) 101 | 72. [Anmol Goel](https://github.com/agoel00) 102 | 73. [Gladson Dsouza](https://github.com/Gladson9) 103 | 74. [PN chandramohan](https://github.com/iamcm1401) 104 | 75. [YIRANO](https://github.com/yirano) 105 | 76. [Kavya042](https://github.com/Kavya042) 106 | 77. [Bruno](https://github.com/dunderbruno) 107 | 78. [Akos](https://github.com/plaidshirtakos) 108 | 79. [Christian Dimas](https://github.com/kenanchristian) 109 | 80. [Mayank Nagpal](https://github.com/mayankn05) 110 | 81. [Giulia Valente](https://github.com/giu-lia) 111 | 82. [Md Akram Kazmi](https://github.com/akramkazmi71) 112 | 83. [Coding Defined](https://github.com/codingdefined) 113 | 84. [Emanuele](https://github.com/EmanuelleViana) 114 | 85. [Mike Wales](https://github.com/walesmd) 115 | 86. [M4l2tIlV](https://github.com/M4l2tIlV) 116 | 87. [Otávio Guimarães](https://github.com/oGuimaraes) 117 | 88. [Gourav Sardana](https://github.com/GouravSardana) 118 | 89. [Dhruval Shah](https://github.com/Dhruval10) 119 | 90. [Lucila Otoni](https://github.com/LucilaOtoni) 120 | 91. [⁵⁷](https://github.com/micky619) 121 | 92. [Lucas Alcântara](https://github.com/lucashmalcantara) 122 | 93. [Bruno Matthaus](https://github.com/bmatthaus) 123 | 94. [Mylena Micaella](https://github.com/mylenamb) 124 | 95. [Vishal Sehgal](https://github.com/CoderVishalSehgal) 125 | 96. [Karen](https://github.com/karenkanashiro) 126 | 97. [Firefly87](https://github.com/Firefly87) 127 | 98. [binn87](https://github.com/binn87) 128 | 99. [sspride5](https://github.com/sspride5) 129 | 100. [Rocktim](https://github.com/RocktimSaikia) 130 | 101. [JPDem](https://github.com/JPDem) 131 | 102. [nephelo7](https://github.com/nephelo7) 132 | 103. [Anirudh Jwala](https://github.com/anirudh-jwala) 133 | 104. [boreme12](https://github.com/boreme12) 134 | 105. [Vaibhav](https://github.com/vaibhavpunia) 135 | 106. [Manisha Tiwari](https://github.com/manishatiwari393) 136 | 107. [Amanda](https://github.com/amandapl) 137 | 108. [Naveen Luhach](https://github.com/naveenluhach) 138 | 109. [Mohamad Arshad](https://github.com/Arshad8607716871) 139 | 110. [Gabriela Prado](https://github.com/gabrielarodriguesp) 140 | 111. [barretoMarcosPaulo](https://github.com/barretoMarcosPaulo) 141 | 112. [Estevao Viana](https://github.com/estevaomrviana) 142 | 113. [Ivan Filho](https://github.com/ivanfilho21) 143 | 114. [Chirag Sukhala](https://github.com/chiragsukhala) 144 | 115. [Renan Guerra](https://github.com/renanguerra) 145 | 116. [JuliaBrazolim](https://github.com/JuliaBrazolim) 146 | 117. [Anish Tilak](https://github.com/anishtilak16) 147 | 118. [Lucas Sousa](https://github.com/lucasousa) 148 | 119. [Mateus Garcia](https://github.com/mpgxc) 149 | 120. [Ronnasayd Machado](https://github.com/Ronnasayd) 150 | 121. [Fernanda Barreto](https://github.com/Ploosh) 151 | 122. [Rafaela Micaela](https://github.com/RafaelaMicaela) 152 | 123. [Sachin Prasad](https://github.com/Sachin-Prasad-2001) 153 | 124. [Nahuel Gallinoti](https://github.com/nahuegallinoti) 154 | 125. [Shikha Srivastava](https://github.com/Shikha785) 155 | 126. [Nafisa Alam](https://github.com/NafuKrypto) 156 | 127. [Shubham Kumar](https://github.com/godmodevegeta) 157 | 128. [Rob Sam](https://github.com/Yarpirates20) 158 | 129. [Edgar Martínez](https://github.com/ewmartinez) 159 | 130. [Akash Bhadana](https://github.com/Akash23536) 160 | 131. [John Harold Sipat](https://github.com/harold137) 161 | 132. [Amitesh Singh Kundan](https://github.com/amiteshsinghk) 162 | -------------------------------------------------------------------------------- /basics-of-github.md: -------------------------------------------------------------------------------- 1 | # Basics of GitHub 2 | There are several tutorials online for github. This is mine. 3 | 4 | GitHub is a version control system. 5 | In simpler words, GitHub provides a huge storage for developers, bussiness companies to store, add, edit their files. 6 | 7 | GitHub is nowadays used for storing programmes of any individual or any organizations. It's free and open source. Though they provide 8 | private repo for [many prices](https://github.com/pricing). 9 | 10 | ## Repo or Repository : 11 | Respository is the area where your works will be saved in GitHub. 12 | 13 | ## Pull request : 14 | Suppose you like a project and wanna contribute on that, so you make changes to a file or files then give the project a pull request. 15 | 16 | Pull request is just a request to the owner of that project to pull your 17 | code to his/her project ( You are requesting to project owner " please pull my code and merge it .") . 18 | 19 | ### Check the git for geek file to know more practical cli Git commands . Try those on your terminal. 20 | --------------------------------------------------------------------------------