├── LICENSE └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 CodeMacrocosm 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # git_intro 2 | 3 | 4 | # Introduction to Version Control Using Git 5 | 6 | ## What is version control ? 7 | 8 | Say you have a bunch of files that go together, such as source code for a project, or files for a website. Now if you want to keep an old version you have to archive a whole directory. Keeping many versions around by hand is inconvenient, and quickly becomes expensive.Version control systems are no different. They all have nice interfaces to manage a directory of stuff. You can save the state of the directory every so often, and you can load any one of the saved states later on.Version control systems are no different. They all have nice interfaces to manage a directory of stuff. You can save the state of the directory every so often, and you can load any one of the saved states later on. 9 | 10 | ### Learning Objectives: 11 | 12 | * #### Learn basic command line interface commands 13 | * mkdir, cd, ls, rm, mv 14 | * installing git 15 | * #### Learn basic git commands 16 | * log, status, diff, stash, commit, add, rm, .gitignore, branch, checkout 17 | * cloning, pulling, push 18 | * #### Learn basic github actions: 19 | * pull requests, forking 20 | 21 | ## Setting up git ! 22 | 23 | Download & Install Git From: http://git-scm.com/downloads 24 | 25 | In your command prompt or terminal use the following commands for respective operations. 26 | 27 | ### Configuring Git Settings (Initial Setup) 28 | 29 | After installing git it is a good idea to introduce yourself to Git with your name and public email address before doing any operation. The easiest way to do so is: 30 | 31 | `git config --global user.email "yourmail@example.com"` 32 | 33 | `git config --global user.name "Your User Name Comes Here"` 34 | 35 | ### Checking Configuration 36 | 37 | To check your credentials just run these commands git reply's with your name. 38 | 39 | `git config user.name` 40 | 41 | `git config user.email` 42 | 43 | Make sure you run all these commands in your working folder / project folder 44 | 45 | ### Making Repos 46 | 47 | `git init` 48 | 49 | You've just told your computer that you want git to watch the 'myProject' folder and keep track of any changes; basically making it so you can now run git commands inside of this folder. 50 | 51 | `git clone ` 52 | 53 | The clone is on an equal with the original project, possessing its own copy of the original project’s history.It just downloads the source file. 54 | 55 | ### Adding Remote 56 | 57 | `git remote add origin https://github.com/user/repo.git` 58 | 59 | This remote helps you to interact with the same repository over and over again. By defining remote repository shorthand, you can make it easier. 60 | 61 | ### Checking Added Remote 62 | 63 | `git remote -v` 64 | 65 | ### Making Changes 66 | 67 | `git status` 68 | 69 | Git briefs you about the current situation. 70 | 71 | `git add .` 72 | 73 | Git to take a snapshot of the contents of all files under the current directory. 74 | 75 | `git commit -m "Commit Message"` 76 | 77 | If you need to make any further adjustments, do so now, and then add any newly modified content to the index. Finally, commit your changes with a commit message. 78 | 79 | `git commit -am "Commit Message"` 80 | 81 | This command makes you to run two commands, one adding all the files and commit changes. 82 | 83 | ### Pushing Repo Code 84 | 85 | `git push origin master ` 86 | 87 | This is used to push commits made on your local branch to a remote repository. 88 | 89 | ### Fetching and Pull 90 | 91 | `git fetch` 92 | 93 | `git pull ` 94 | --------------------------------------------------------------------------------