{"id":13760417,"url":"https://github.com/GoldinGuy/UltimateGitResource","last_synced_at":"2025-05-10T10:32:46.525Z","repository":{"id":108724003,"uuid":"323809304","full_name":"GoldinGuy/UltimateGitResource","owner":"GoldinGuy","description":"📚 The ultimate collection of git commands and resources to power up your programming!","archived":false,"fork":false,"pushed_at":"2021-09-26T17:28:19.000Z","size":26377,"stargazers_count":397,"open_issues_count":0,"forks_count":46,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-11-16T14:22:48.374Z","etag":null,"topics":["cheat-sheet","git","git-cheatsheet","git-commands","git-resource","github","github-pages","learn-git","learn-github","resource","ultimate"],"latest_commit_sha":null,"homepage":"https://goldinguy.github.io/UltimateGitResource/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GoldinGuy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-12-23T05:16:48.000Z","updated_at":"2024-11-03T23:49:35.000Z","dependencies_parsed_at":"2023-04-12T17:06:04.202Z","dependency_job_id":null,"html_url":"https://github.com/GoldinGuy/UltimateGitResource","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoldinGuy%2FUltimateGitResource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoldinGuy%2FUltimateGitResource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoldinGuy%2FUltimateGitResource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoldinGuy%2FUltimateGitResource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoldinGuy","download_url":"https://codeload.github.com/GoldinGuy/UltimateGitResource/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224949822,"owners_count":17397239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cheat-sheet","git","git-cheatsheet","git-commands","git-resource","github","github-pages","learn-git","learn-github","resource","ultimate"],"created_at":"2024-08-03T13:01:09.848Z","updated_at":"2024-11-16T17:31:07.562Z","avatar_url":"https://github.com/GoldinGuy.png","language":null,"readme":"# UltimateGitResource\n📚 A list of helpful Git commands for the Google DSC Git Event \u0026 Hackapalooza Hackathon\n\n[![Discuss On Discord][discord]][discord-url]\n[![Contributors][contributors-shield]][contributors-url]\n[![Issues][issues]][issues-url]\n\n[**Watch a recording of the All About Git presentation here!**](https://www.youtube.com/watch?v=mqhDMv6nIVI)\n\nGit is the most popular [version control system](https://en.wikipedia.org/wiki/Version_control). It tracks changes you make to files and keeps a record of your work. It also lets you revert to earlier versions of your code if the need arises. Git drastically improves collaboration, allowing multiple people to work in sync on the same source code. Below is a selection of the most helpful and commonly used Git commands to power up your programming!\n\n*Note - Wherever used the shorthand `Repo` means [Repository](https://en.wikipedia.org/wiki/Repository_(version_control))*\n\nThe [Docs](https://github.com/GoldinGuy/UltimateGitResource/tree/main/docs) folder of this repo contains a simple profile/resume static site built on HTML5 and [TailwindCSS](https://v1.tailwindcss.com/) to help learn about [Github pages](https://pages.github.com/). You can clone the repository and test it out yourself, or visit [this link](https://goldinguy.github.io/UltimateGitResource/) to see a live demo. For more info look at the [README](https://github.com/GoldinGuy/UltimateGitResource/blob/main/docs/README.md) for the `/docs` directory.\n\nThis repo contains a powerpoint presentation explaning many of these commands that can be viewed online [here](https://docs.google.com/presentation/d/1BHa_ZxiyRRJQKaCRXTozmMhlPgkFcx-zn5esd5n-HWY/edit?usp=sharing).\n\n## Table of Contents\n\n- [Installing Git](https://docs.github.com/en/free-pro-team@latest/github/getting-started-with-github/set-up-git)\n- [Gitting Existing Projects](#-gitting-existing-projects)\n- [Gitting Started - Setting Up a New Repo](#-gitting-started---setting-up-a-new-repo)\n- [The Nitty Gitty - Examine History \u0026 State](#-the-nitty-gitty---examine-history--state)\n- [Branching Out - Grow, Mark \u0026 Tweak History](#-branching-out---grow-mark--tweak-history)\n- [Git Gud - Dealing With Merge Conflicts](#-git-gud---dealing-with-merge-conflicts)\n- [Git More - Pushing, Pulling, \u0026 Remote Origin](#-git-more---pushing-pulling--remote-origin)\n- [Gitting Complicated - The Danger Zone](#-gitting-complicated---the-danger-zone)\n- [Git Resources](#-more-git-resources)\n- [Contributing](#contributing)\n\n## Git Commands\n\nYou can run `git help` in the terminal to learn about many of these commands at any time. `git help -a` and `git help -g` list available subcommands and \nconcept guides. `git help \u003ccommand\u003e` or `git help \u003cconcept\u003e` allow you to read about a specific subcommand or concept.\n\n`HEAD` represents your current working directory. The `HEAD` pointer can be moved to different branches, tags, or commits using `git checkout`.\n\nThe `gitignore` file allows you to control what gets committed and what doesn't, allowing you to keep your keys and passwords secure, and reducing the amount of bloat on the remote repo. You can learn more about it in the [.gitignore file](https://github.com/GoldinGuy/UltimateGitResource/blob/main/.gitignore) above.\n\n\n### 📗 Gitting Existing Projects\n\n| Command | Description |\n| ------- | ----------- |\n| `git clone ssh://git@github.com/\u003cusername\u003e/\u003crepository-name\u003e.git` | Create a local copy of a remote repo using SSH |\n| `git clone https://github.com/\u003cusername\u003e/\u003crepository-name\u003e.git` | Create a local copy of a remote repo using HTTPS |\n\nYou can also [fork](https://github.com/GoldinGuy/UltimateGitResource/fork) repos *(create a copy of the original repo that remains on your GitHub account)*.\n\n\n### 📘 Gitting Started - Setting Up a New Repo\n\n| Command | Description |\n| ------- | ----------- |\n| `git init` | Initialize a local Git repository |\n| `git add .` | Add all files in the working directory to the staging area |\n| `git commit -m \"\u003ccommit message\u003e\"` | Commit your changes |\n| `git remote add origin git@github.com:\u003cusername\u003e/\u003crepository-name\u003e.git` | Add upstream repo to publish commits at (the remote repo) |\n| `git push -u origin master` | Push your changes to remote repository |\n\n#### More Options For Staging Files\n\n| Command | Description |\n| ------- | ----------- |\n| `git add \u003cfile-name.txt\u003e` | Add a single file to the staging area |\n| `git add -A` | Add all files in all directories to the staging area |\n| `git rm -r \u003cfile-name.txt\u003e` | Remove a single file (or folder) |\n| `git rm -r . --cached` | Remove all files recursively from staging area |\n\n\n### 📙 The Nitty Gitty - Examine History \u0026 State\n\n| Command | Description |\n| ------- | ----------- |\n| `git status` | See details about the current branch |\n| `git show` | Shows changes in committed files |\n| `git log` | View changes in commit history |\n| `git log --summary` | View changes (detailed) |\n| `git log --oneline` | View changes (briefly) |\n| `git diff \u003csource branch\u003e \u003ctarget branch\u003e` | Preview changes before merging |\n\n\n### 📒 Branching Out - Grow, Mark \u0026 Tweak History\n\n| Command | Description |\n| ------- | ----------- |\n| `git branch` | List branches (the * is the current branch) |\n| `git branch -a` | List all branches (local and remote) |\n| `git branch \u003cbranch name\u003e` | Create a new local branch |\n| `git branch -d \u003cbranch name\u003e` | Delete a local branch |\n| `git push origin --delete \u003cbranch name\u003e` | Delete a remote branch |\n| `git checkout -b \u003cbranch name\u003e` | Create a new local branch and switch to it |\n| `git checkout -b \u003cbranch name\u003e origin/\u003cbranch name\u003e` | Clone a remote branch and switch to it |\n| `git branch -m \u003cold branch name\u003e \u003cnew branch name\u003e` | Rename a local branch |\n| `git checkout \u003cbranch name\u003e` | Switch to a branch |\n| `git checkout -` | Switch to the most recent branch |\n| `git checkout -- \u003cfile-name.txt\u003e` | Revert your recent changes to a file |\n\n\n### 📕 Git Gud - Dealing With Merge Conflicts\n\n| Command | Description |\n| ------- | ----------- |\n| `git merge \u003cbranch name\u003e` | Merge a branch into the active branch |\n| `git merge \u003csource branch\u003e \u003ctarget branch\u003e` | Merge a branch into a target branch |\n| `git merge --abort` | Abort the current conflict resolution process, and attempt to reconstruct the pre-merge state |\n| `git stash` | Stash changes in a dirty working directory |\n| `git stash clear` | Remove all stashed entries |\n\n\n### 📓 Git More - Pushing, Pulling, \u0026 Remote Origin\n\n| Command | Description |\n| ------- | ----------- |\n| `git push origin \u003cbranch name\u003e` | Push a branch to your remote repo |\n| `git push -u origin \u003cbranch name\u003e` | Push changes to remote repo (and remember the branch) |\n| `git push` | Push changes to remote repo (only if you have previously set a remote origin) |\n| `git push origin --delete \u003cbranch name\u003e` | Delete a remote branch |\n| `git pull` | Synchronize local repo with remote repo |\n| `git pull origin \u003cbranch name\u003e` | Pull changes from remote repo |\n| `git fetch` | Checks to see if there are any changes on the remote repo (does not pull changes) | \n| `git fetch --prune` | Fetch all remote branch refs and delete those no longer in use |\n| `git remote -v` | Shows URLs of remote repositories when listing your current remote connections |\n| `git remote add origin ssh://git@github.com/\u003cusername\u003e/\u003crepository-name\u003e.git`| Add upstream repo to publish commits at (the remote repo) |\n| `git remote set-url origin ssh://git@github.com/\u003cusername\u003e/\u003crepository-name\u003e.git` | Set a repo's origin branch to SSH |\n\n\n### 📔 Gitting Complicated - The Danger Zone\n\n*HEY! Changing your history may cause undesired side effects. You may lose data. Many of these commands cannot be undone. If you change your remote history, don't say I didn't warn you.*\n\n| Command | Description |\n| ------- | ----------- |\n| `git rebase \u003cbranch\u003e` |  Reapply commits on top of another base tip |\n| `git rebase -i \u003ccommitID\u003e` | Reapply all commits from \u003ccommitID forward |\n| `git cherry-pick \u003ccommitID\u003e` | Apply the changes introduced by some existing commits |\n| `git clean -f` | Removes and deletes untracked files from the working tree |\n| `git clean -fd` | Remove all untracked directories |\n| `git commit --amend` | Allows you to edit a previous commit that has not been pushed |\n| `git commit --fixup \u003ccommitID\u003e` | Combine new changes with an existing commit under the same name |\n| `git reset \u003ccommitID\u003e` | Reverts all commits after specified commit, while keeping local changes |\n| `git reset --hard \u003ccommitID\u003e` | Reverts all history and changes back to the given commit |\n| `git reset HEAD~1` | Revert 1 commit (while keeping current local state) |\n| `git push origin \u003cbranch\u003e --force` | Deletes all your previous commits and pushes your current one |\n\n\n### 📖 More Git Resources\n- [Git Docs](https://git-scm.com/doc), for those who want to dive deep into the documentation\n- [Git Handbook](https://guides.github.com/introduction/git-handbook/), for those who want a quick overview\n- [Visual Git CheatSheet](https://ndpsoftware.com/git-cheatsheet.html), for those who are visual learners\n- [Official Printable PDF CheatSheet](https://training.github.com/downloads/github-git-cheat-sheet.pdf), for those who need the physical copy\n- [Visualize Git Under the Hood](https://git-school.github.io/visualizing-git/), allows you to explore exactly how commands affect repo structure\n- [Stanford GitMagic](http://www-cs-students.stanford.edu/~blynn/gitmagic/), a plain but detailed quide to git\n- [GitReady](http://gitready.com/), lets you learn git one commit at a time\n- [Git From the Bottom Up](https://jwiegley.github.io/git-from-the-bottom-up/), gives you a better understanding of the powerful system\n- [Git, the Simple Guide](https://rogerdudler.github.io/git-guide/), as stated, with no deep knowledge required\n- [Git Explained (Not just commands)](https://towardsdatascience.com/git-help-all-2d0bb0c31483), a brief guide including more than commands\n- [Git-It](https://github.com/jlord/git-it-electron#what-to-install), an app that teaches you git via challenges in the terminal\n- [Interactive Way to Learn Git Branching](https://learngitbranching.js.org/), for an enjoyable way to tackle an important concept\n- [Git Markdown Emoji](https://github.com/ikatyang/emoji-cheat-sheet), to spice up your Git repos\n- [Article on Writing Good Commit Messages](https://chris.beams.io/posts/git-commit/), which pretty much everyone could stand to improve ;)\n- [Github Student Developer Pack](https://education.github.com/pack), seriously, if you're a student you should have this\n- [Intro to Git Rebase](https://dev.to/maxwell_dev/the-git-rebase-introduction-i-wish-id-had), a great explanation of a powerful command\n\n\n### Contributing\n\n1. Fork UltimateGitResource [here](https://github.com/GoldinGuy/UltimateGitResource/fork)\n2. Create a branch with your improvements (`git checkout -b improvement/fooBar`)\n3. Commit your changes (`git commit -am 'Add some fooBar'`)\n4. Push to the branch (`git push origin improvement/fooBar`)\n5. Create a new Pull Request\n\n#### Meta\n\nCreated by [@GoldinGuy](https://github.com/GoldinGuy) for the FAU Google DSC Git Event.\n\n\u003c!-- Markdown link \u0026 img dfn's --\u003e\n\n[discord-url]: https://discord.gg/gKYSMeJ\n[discord]: https://img.shields.io/discord/689176425701703810\n[issues]: https://img.shields.io/github/issues/GoldinGuy/UltimateGitResource\n[issues-url]: https://github.com/GoldinGuy/UltimateGitResource/issues\n[contributors-shield]: https://img.shields.io/github/contributors/GoldinGuy/UltimateGitResource.svg?style=flat-square\n[contributors-url]: https://github.com/GoldinGuy/UltimateGitResource/graphs/contributors\n","funding_links":[],"categories":["Others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGoldinGuy%2FUltimateGitResource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGoldinGuy%2FUltimateGitResource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGoldinGuy%2FUltimateGitResource/lists"}