├── .practy.js.swo ├── MyReadme.md ├── NewReadme.md ├── README.md ├── branch1502 └── test-file.txt ├── dimitris_announcement ├── norajs ├── booby.jpg └── readme.txt └── practice-git └── foo.txt /.practy.js.swo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grayghostvisuals/practice-git/ed7469cc96696a8fd8092ca937c10f8b04de9368/.practy.js.swo -------------------------------------------------------------------------------- /MyReadme.md: -------------------------------------------------------------------------------- 1 | #Lets start markdown 2 | 3 | I just now heard about markdown 4 | 5 | Also have an understanding of git but github has me confused 6 | -------------------------------------------------------------------------------- /NewReadme.md: -------------------------------------------------------------------------------- 1 | #Hello there! 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### :octocat: Git Your Practice On! 2 | 3 | * 19 Git Tips for Everyday use [http://www.alexkras.com/19-git-tips-for-everyday-use](http://www.alexkras.com/19-git-tips-for-everyday-use) 4 | * Git Hot Tips by Wes Bos [https://wesbos.com/git-hot-tips/](https://wesbos.com/git-hot-tips/) 5 | * Git Reference [https://help.github.com/categories/github-pages-basics/](https://help.github.com/categories/github-pages-basics/) 6 | * Pro Git Online Book [http://git-scm.com/book](http://git-scm.com/book) 7 | * Git Ready [http://gitready.com](http://gitready.com) 8 | * Quick Command Practice [http://try.github.com](http://try.github.com) 9 | * Git Real [http://www.codeschool.com/courses/git-real](http://www.codeschool.com/courses/git-real) 10 | * How to GitHub: Fork, Branch, Track, Squash and Pull Request [http://gun.io/blog/how-to-github-fork-branch-and-pull-request](http://gun.io/blog/how-to-github-fork-branch-and-pull-request) 11 | * Learn Git Online [http://learn.github.com/p/intro.html](http://learn.github.com/p/intro.html) 12 | * Teach Github [https://github.com/github/teach.github.com](https://github.com/github/teach.github.com) 13 | * Git: The Simple Guide [http://rogerdudler.github.com/git-guide](http://rogerdudler.github.com/git-guide) 14 | * Git Immersion [http://gitimmersion.com](http://gitimmersion.com) 15 | * Git Branching [http://pcottle.github.io/learnGitBranching/](http://pcottle.github.io/learnGitBranching/) 16 | * Git Cheat Sheet [https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet](https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet) 17 | 18 | 19 | Welcome to my practice git repository where you can eff up as much as you'd like plus work with a real, living, breathing person on the other side. 20 | Here we learn all things git. Feel free to send me Pull Requests just to discover what it's like when a Repo Master asks you 21 | 22 |
23 | "Can you squash your commits for us" 24 |
25 | 26 | and you're all like... 27 | 28 |
29 | "How the hell do I do that?" 30 |
31 | 32 | This is where we make those mistakes ... so don't be scared :) 33 | 34 | ### Instructions 35 | 36 | Fork this repo and send me a Pull Request with anything from Grandma Peggy's Crumbled Oatmeal Cookie Recipe to your favorite Sublime Text 2 preferences. 37 | It's all good yo! Learning is the prize in this game. 38 | 39 | #### Typical & Highly Useful Git Commands 40 | 41 | ```bash 42 | git clone git@github.com:/the-repo-you-are-cloning.git 43 | ``` 44 | Clones your remote origin repo locally 45 | 46 | ```bash 47 | git fetch upstream 48 | ``` 49 | Pulls in the remote changes not present in your local repo. Downloads objects and references from another repository. 50 | 51 | ```bash 52 | git merge upstream/master 53 | ``` 54 | Merges any changes fetched into your working files 55 | 56 | ```bash 57 | git add 58 | ``` 59 | Start tracking new files and also stage changes to already tracked files 60 | 61 | ``git status`` & ``git diff`` 62 | * Tells us what files and assets have been modified and staged 63 | 64 | ```bash 65 | git status -s 66 | ``` 67 | This will display what files have been removed, changed or modified. 68 | 69 | * (M) - modified 70 | * (A) - added 71 | * (AM) - file has not been altered since it was last added 72 | 73 | ```bash 74 | git commit -m 'the message goes here for the commit' 75 | ``` 76 | Records a snapshot of the project into your history at the time of your commit. 77 | 78 | ```bash 79 | git add '*.' 80 | ``` 81 | This command adds all file types with the same extension, especially from different directories. Without quotes the command will only execute within the same directory it's been called from. 82 | 83 | ```bash 84 | git rm --cached 85 | ``` 86 | Unstages a file from the working tree (i.e. stops tracking the file). 87 | 88 | ```bash 89 | git log 90 | ``` 91 | Remembers all the changes we've committed so far, in the order we committed them. 92 | 93 | ```bash 94 | git log --summary 95 | ``` 96 | See where new files were added for the first time or where files were deleted. 97 | 98 | ```bash 99 | git remote add origin git@github.com:/.git 100 | ``` 101 | Creates a brand new remote repository. 102 | 103 | ```bash 104 | git remote -v 105 | ``` 106 | Show a list of the current remote repositories 107 | 108 | ```bash 109 | git reset 110 | ``` 111 | Removes the desired file from staging area. 112 | 113 | ```bash 114 | git branch -r 115 | ``` 116 | List all the remote branches currently tracked 117 | 118 | ```bash 119 | git remote prune origin 120 | ``` 121 | Deletes branch locally if it has been removed remotely. Helps to remove stale references. 122 | 123 | ```bash 124 | git checkout -- 125 | ``` 126 | Changes the desired target back to the state of the last commit. A target can be a file or a directory (for example). 127 | 128 | ```bash 129 | git rebase 130 | ``` 131 | Rebase allows you to [easily change a series of commits, reordering, editing, or squashing commits together into a single commit](https://help.github.com/articles/interactive-rebase). 132 | 133 | Be warned: it's considered bad practice to rebase commits which you have already pushed to a remote repo. Doing so may invoke the wrath of the git gods. [https://help.github.com/articles/interactive-rebase](https://help.github.com/articles/interactive-rebase) 134 | 135 | ### Adding 136 | ```bash 137 | git add 138 | ``` 139 | (i.e. ``git add readme.md license.txt``. Can be multiples) 140 | 141 | ```bash 142 | git add --all 143 | ``` 144 | Add all the new files since last 145 | 146 | ```bash 147 | git add *.txt 148 | ``` 149 | Add all txt files in directory 150 | 151 | ### Staging 152 | ```bash 153 | git diff 154 | ``` 155 | Show unstaged differences since last commit 156 | 157 | ```bash 158 | git diff --staged 159 | ``` 160 | Gets the staged differences and displays what has changed since our last commit 161 | 162 | ### Reverting 163 | ```bash 164 | git reset HEAD 165 | ``` 166 | Head is the last commit on the current branch we are on. What if you stage something you didn't need to be staged? This is the key. 167 | 168 | ```bash 169 | git checkout -- 170 | ``` 171 | Reset all changes to a file since last commit 172 | 173 | ```bash 174 | git reset --soft HEAD^ 175 | ``` 176 | What if you regret a commit? This will undo your last commit. (^ means move commit before HEAD and puts changes into staging). 177 | 178 | ```bash 179 | git reset --hard HEAD^ 180 | ``` 181 | Traverse through commits and revert back one by one. 182 | 183 | ```bash 184 | git reset --hard HEAD 185 | ``` 186 | Undo Last commit and all changes 187 | 188 | ```bash 189 | git commit --amend -m "added another file to the commit' 190 | ``` 191 | New commit message will override previous commit message 192 | 193 | ### Remotes 194 | "Remotes are kinda like bookmarks" 195 | 196 | ```bash 197 | git remote -v 198 | ``` 199 | Show the current remote repos 200 | 201 | ```bash 202 | git remote add
203 | ``` 204 | Add a new remote repo 205 | 206 | ```bash 207 | git remote rm 208 | ``` 209 | Remove remote repo 210 | 211 | ### Cloning, Branching, Fetching & Merging 212 | ```bash 213 | git fetch 214 | ``` 215 | Pulls down any changes but doesn't merge them 216 | 217 | ```bash 218 | git branch 219 | ``` 220 | Makes a new branch 221 | 222 | ```bash 223 | git checkout 224 | ``` 225 | Switching branch and on a different timeline 226 | 227 | ```bash 228 | git merge 229 | ``` 230 | Merges branch into master 231 | 232 | ```bash 233 | git branch -d 234 | ``` 235 | Deletes branch 236 | 237 | ```bash 238 | git checkout -b 239 | ``` 240 | Creates a new branch and then switches to it 241 | 242 | ```bash 243 | :wq + enter 244 | ``` 245 | VI Editor Quick Key Exit 246 | 247 | ```bash 248 | g fetch origin 249 | 250 | git checkout -t / 251 | ``` 252 | Fetches a remote branch not available locally [also reference issue #7](https://github.com/grayghostvisuals/Practice-Git/issues/7) 253 | 254 | ### Pushing & Pulling 255 | ```bash 256 | git push -u origin master (remote repo name[origin], local branch name[master]) 257 | ``` 258 | Lets you just run git push later on without specifying name and branch 259 | 260 | ```bash 261 | git pull 262 | ``` 263 | Pull changes in and syncs up your repo. Doesn't update local code 264 | 265 | ### Branching 266 | ```bash 267 | git branch -r 268 | ``` 269 | List all remote branches 270 | 271 | ```bash 272 | git remote show origin 273 | ``` 274 | Show all the remote branches 275 | 276 | ```bash 277 | git push origin : 278 | ``` 279 | Deletes the remote branch 280 | 281 | ```bash 282 | git branch -D 283 | ``` 284 | Delete the local repo branch and if you don't want the commits any longer on it then delete them too. 285 | 286 | ```bash 287 | git remote prune origin 288 | ``` 289 | Deletes the branch locally if it has been removed remotely. Helps to remove stale references. 290 | 291 | ### Rebasing 292 | "Merge commits are bad" 293 | 294 | ```bash 295 | git rebase 296 | ``` 297 | Move all changes to master local which are not in origin/master remote to a temporary area 298 | 299 | ### History 300 | ```bash 301 | git log 302 | ``` 303 | Viewing the commits history 304 | 305 | ```bash 306 | git config --global color.ui true 307 | ``` 308 | Color codes the commit SHA 309 | 310 | ```bash 311 | git log --pretty=oneline 312 | ``` 313 | 314 | or 315 | 316 | ```bash 317 | git log --graph --oneline --all 318 | ``` 319 | Commit and history is one line 320 | 321 | ```bash 322 | git log --pretty=format:"%h 323 | ``` 324 | Exactly how you want the output using placeholders (use git help log) 325 | 326 | ```bash 327 | git log --until 328 | ``` 329 | Date Ranges. For example you could grab everything from the year 2013 using ``git log --until 2013`` 330 | 331 | ### Removal 332 | ```bash 333 | git rm 334 | ``` 335 | Removes file completely 336 | 337 | ```bash 338 | git rm --cached 339 | ``` 340 | Won't be deleted from your file system, but keeps the local changes still. 341 | 342 | ### Help 343 | ```bash 344 | git help 345 | ``` 346 | ```bash 347 | git help 348 | ``` 349 | #### Nasty link 350 | -------------------------------------------------------------------------------- /branch1502/test-file.txt: -------------------------------------------------------------------------------- 1 | some text goes here. 2 | some new text edit goes here. 3 | nope 4 | yep 5 | -------------------------------------------------------------------------------- /dimitris_announcement: -------------------------------------------------------------------------------- 1 | I'm having a baby girl in March and I'm shouting it at the top of Git mountain! 2 | -------------------------------------------------------------------------------- /norajs/booby.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grayghostvisuals/practice-git/ed7469cc96696a8fd8092ca937c10f8b04de9368/norajs/booby.jpg -------------------------------------------------------------------------------- /norajs/readme.txt: -------------------------------------------------------------------------------- 1 | Thanks yo for the practice project :) Gonna mess around here a little. 2 | 3 | Nora 4 | Hello 5 | -------------------------------------------------------------------------------- /practice-git/foo.txt: -------------------------------------------------------------------------------- 1 | lorem 2 | --------------------------------------------------------------------------------