|
| 1 | +<!-- |
| 2 | +CO_OP_TRANSLATOR_METADATA: |
| 3 | +{ |
| 4 | + "original_hash": "5cf5e1ed51455fefed4895fcc4d6ba2a", |
| 5 | + "translation_date": "2026-01-08T10:45:55+00:00", |
| 6 | + "source_file": "Git-Basics/README.md", |
| 7 | + "language_code": "pcm" |
| 8 | +} |
| 9 | +--> |
| 10 | +## Basics of GIT for web-dev beginners👶 |
| 11 | + |
| 12 | + |
| 13 | +## Wetin be `Git`? |
| 14 | + 1. Git na one kind distributed version control system. |
| 15 | + 2. Di whole codebase and history dey available for every developer computer, |
| 16 | + wey dey allow easy branching and merging. |
| 17 | + 3. Dem dey use am as Version Control System (VCS) to track changes for computer files. |
| 18 | + |
| 19 | +* Distributed version control |
| 20 | +* E dey coordinate work between many developers |
| 21 | +* Who change wetin and when |
| 22 | +* Fit revert back anytime |
| 23 | +* Local & remote repos |
| 24 | + |
| 25 | +## CONCEPTS OF GIT |
| 26 | +* E dey keep track of code history |
| 27 | +* E dey take "snapshots" of your files |
| 28 | +* Na you dey decide when to take snapshot by doing "commit" |
| 29 | +* You fit go any snapshot anytime |
| 30 | +* You fit stage files before you commit |
| 31 | + |
| 32 | +### Difference Between Git & GitHub |
| 33 | + |
| 34 | +| Git | GitHub | |
| 35 | +| ------- | ----------- | |
| 36 | +| Git na software | GitHub na cloud service | |
| 37 | +| Git dey installed locally for system | GitHub dey hosted for web | |
| 38 | +| Na command-line tool e be | Na graphical user interface e be | |
| 39 | +| Linux dey maintain Git | Microsoft dey maintain GitHub | |
| 40 | +| E focus on version control and code sharing | E focus on centralized source code hosting | |
| 41 | +| Git get open-source license | GitHub get free-tier plus pay-for-use tier | |
| 42 | +| Git release for 2005 | GitHub release for 2008 | |
| 43 | + |
| 44 | + |
| 45 | +## GIT Installation |
| 46 | +* Linux(Debian) |
| 47 | + `$sudo apt-get install git` |
| 48 | +* Linux(Fedora) |
| 49 | + `$sudo yum install git` |
| 50 | +* [Download](http://git-scm.com/download/mac) for Mac |
| 51 | +* [Download](http://git-scm.com/download/win) for Windows |
| 52 | + |
| 53 | + |
| 54 | +### Installation Process Steps: |
| 55 | +1. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190359823-e421b976-515a-4565-990d-2f2e4e62977a.png"/> |
| 56 | +2. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190360530-a7bfa681-47f4-4859-9b8a-4120e0cad348.png"/> |
| 57 | +3. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190360760-30db7768-19e0-4848-a99d-a6c955e041e2.png"/> |
| 58 | +4. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190360896-473e1e54-f083-4b5c-a5f0-539f70469142.png"/> |
| 59 | +5. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190361144-bc670a2b-b776-4867-9785-7b509d416fbb.png"/> |
| 60 | +6. And then Continue Next > Next > Next > <b>Install</b> |
| 61 | +7. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190361548-4b700d85-c7d5-4d26-90e7-e5cc3ce24311.png"/> |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + ### After you don install, we need configure git using git bash |
| 70 | + 1. `git config --global user.name 'YourName'` |
| 71 | + 2. `git config --global user.email 'YourEmail'` |
| 72 | +___ |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +## Git Commands |
| 77 | +___ |
| 78 | + |
| 79 | +### Getting & Creating Projects |
| 80 | + |
| 81 | +| Command | Description | |
| 82 | +| ------- | ----------- | |
| 83 | +| `git init` | Start local Git repository | |
| 84 | +| `git clone ssh://git@github.com/[username]/[repository-name].git` | Make local copy of remote repository | |
| 85 | + |
| 86 | +### Basic Snapshotting |
| 87 | + |
| 88 | +| Command | Description | |
| 89 | +| ------- | ----------- | |
| 90 | +| `git status` | Check status | |
| 91 | +| `git add [file-name.txt]` | Add file to staging area | |
| 92 | +| `git add -A` | Add all new and changed files to staging area | |
| 93 | +| `git commit -m "[commit message]"` | Commit changes | |
| 94 | +| `git rm -r [file-name.txt]` | Remove file or folder | |
| 95 | +| `git push` | Push To Remote Repository | |
| 96 | +| `git pull` | Pull Latest Changes From Remote Repository | |
| 97 | + |
| 98 | +### Branching & Merging |
| 99 | + |
| 100 | +| Command | Description | |
| 101 | +| ------- | ----------- | |
| 102 | +| `git branch` | List branches (asterisk na current branch) | |
| 103 | +| `git branch -a` | List all branches (local and remote) | |
| 104 | +| `git branch [branch name]` | Create new branch | |
| 105 | +| `git branch -D [branch name]` | Delete branch | |
| 106 | +| `git push origin --delete [branch name]` | Delete remote branch | |
| 107 | +| `git checkout -b [branch name]` | Create and switch to new branch | |
| 108 | +| `git checkout -b [branch name] origin/[branch name]` | Clone remote branch and switch to am | |
| 109 | +| `git branch -m [old branch name] [new branch name]` | Rename local branch | |
| 110 | +| `git checkout [branch name]` | Switch to branch | |
| 111 | +| `git checkout -` | Switch to last checked branch | |
| 112 | +| `git checkout -- [file-name.txt]` | Discard changes to file | |
| 113 | +| `git merge [branch name]` | Merge branch into active branch | |
| 114 | +| `git merge [source branch] [target branch]` | Merge branch into target branch | |
| 115 | +| `git stash` | Stash changes for dirty working directory | |
| 116 | +| `git stash clear` | Remove all stashed entries | |
| 117 | + |
| 118 | +### Sharing & Updating Projects |
| 119 | + |
| 120 | +| Command | Description | |
| 121 | +| ------- | ----------- | |
| 122 | +| `git push origin [branch name]` | Push branch to your remote repository | |
| 123 | +| `git push -u origin [branch name]` | Push changes to remote and remember branch | |
| 124 | +| `git push` | Push changes to remote (remembered branch) | |
| 125 | +| `git push origin --delete [branch name]` | Delete remote branch | |
| 126 | +| `git pull` | Update local repo to newest commit | |
| 127 | +| `git pull origin [branch name]` | Pull changes from remote repository | |
| 128 | +| `git remote add origin ssh://git@github.com/[username]/[repository-name].git` | Add remote repository | |
| 129 | +| `git remote set-url origin ssh://git@github.com/[username]/[repository-name].git` | Set origin branch to SSH | |
| 130 | + |
| 131 | +### Inspection & Comparison |
| 132 | + |
| 133 | +| Command | Description | |
| 134 | +| ------- | ----------- | |
| 135 | +| `git log` | View changes | |
| 136 | +| `git log --summary` | View changes (detailed) | |
| 137 | +| `git log --oneline` | View changes (brief) | |
| 138 | +| `git diff [source branch] [target branch]` | Preview changes before merging | |
| 139 | + |
| 140 | +--- |
| 141 | + |
| 142 | +<!-- CO-OP TRANSLATOR DISCLAIMER START --> |
| 143 | +**Disclaimer**: |
| 144 | +Dis document na AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) translate am. Even though we dey try make am correct, make you sabi say automated translation fit get some mistakes or no too clear. Di original document wey e dey for im correct language na di main correct source. If na serious information, better make person wey sabi do professional human translation do am. We no go take responsibility if pesin no understand well or e get wahala because of this translation. |
| 145 | +<!-- CO-OP TRANSLATOR DISCLAIMER END --> |
0 commit comments