{"id":27874563,"url":"https://github.com/markphamm/git-github","last_synced_at":"2026-05-01T04:40:34.668Z","repository":{"id":253682661,"uuid":"844210639","full_name":"MarkPhamm/Git-Github","owner":"MarkPhamm","description":"A practical reference guide to help you understand and navigate the most commonly used Git commands — from setup to collaboration.","archived":false,"fork":false,"pushed_at":"2025-04-20T20:35:34.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-20T21:29:37.164Z","etag":null,"topics":["git","github"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MarkPhamm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-18T17:57:06.000Z","updated_at":"2025-04-20T20:35:54.000Z","dependencies_parsed_at":"2024-08-26T23:13:11.331Z","dependency_job_id":"b62b8306-0ded-4d34-a7db-36af3f11cd60","html_url":"https://github.com/MarkPhamm/Git-Github","commit_stats":null,"previous_names":["markphamm/git_learn","markphamm/learn-git","markphamm/git-github"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkPhamm%2FGit-Github","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkPhamm%2FGit-Github/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkPhamm%2FGit-Github/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkPhamm%2FGit-Github/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarkPhamm","download_url":"https://codeload.github.com/MarkPhamm/Git-Github/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252424473,"owners_count":21745765,"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":["git","github"],"created_at":"2025-05-05T01:36:14.228Z","updated_at":"2026-05-01T04:40:29.648Z","avatar_url":"https://github.com/MarkPhamm.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Exploring Git commands  \nA practical reference guide to help you understand and navigate the most commonly used Git commands — from setup to collaboration.\n\n\u003cimg src=\"https://github.com/user-attachments/assets/3d707073-4acb-4d6d-a519-76af029b6c42\" width=\"100%\"/\u003e\n\n---\n\n## Repository Setup\n\n1. `git init` — Initialize a new Git repository  \n2. `git clone [URL]` — Clone an existing repository  \n3. `git remote add origin [URL]` — Add a remote repository  \n4. `git remote -v` — List remote repositories  \n5. `git config --global user.name \"[name]\"` — Set the global username for commits  \n6. `git config --global user.email \"[email]\"` — Set the global email for commits  \n7. `git config --global core.editor [editor]` — Set the default editor for Git  \n8. `git config user.name \"[name]\"` — Set the local username for the current repository  \n9. `git config user.email \"[email]\"` — Set the local email for the current repository  \n10. `git config --list` — List all Git config values  \n11. `git config --list --show-origin` — Show config values with the source file  \n\n---\n\n## Basic Workflow\n\n12. `git status` — Show the working directory status  \n13. `git add [file]` — Stage changes for commit  \n14. `git add *` — Stage all changes for commit  \n15. `git commit -m \"[message]\"` — Commit staged changes with a message  \n16. `git commit -a -m \"[message]\"` — Stage and commit all changes in one step  \n17. `git push origin [branch]` — Push changes to the remote repository  \n18. `git pull` — Fetch and merge changes from the remote repository  \n19. `git fetch` — Fetch changes from the remote without merging  \n20. `git log` — View commit history  \n21. `git log --oneline` — View simplified commit history  \n22. `git show [commit]` — Show details of a specific commit  \n23. `git diff` — Show changes between commits, branches, or working directory  \n24. `git diff --staged` — Show changes between staged files and the last commit  \n\n---\n\n## Branching\n\n25. `git branch` — List all local branches  \n26. `git branch [branch-name]` — Create a new branch  \n27. `git checkout [branch-name]` — Switch to an existing branch  \n28. `git checkout -b [branch-name]` — Create and switch to a new branch  \n29. `git merge [branch-name]` — Merge a branch into the current branch  \n30. `git branch -d [branch-name]` — Delete a local branch  \n31. `git push origin --delete [branch-name]` — Delete a remote branch  \n32. `git branch -r` — List all remote branches  \n33. `git branch -a` — List all branches (local and remote)  \n\n---\n\n## Undoing \u0026 History Editing\n\n34. `git reset [file]` — Unstage a file, keeping its changes  \n35. `git reset --hard [commit]` — Reset working directory and index to a specific commit  \n36. `git revert [commit]` — Create a new commit that undoes a previous one  \n37. `git checkout -- [file]` — Discard changes in a file  \n38. `git stash` — Save changes temporarily to switch branches  \n39. `git stash pop` — Reapply the most recent stash and remove it  \n40. `git stash list` — List all stashed changes  \n41. `git commit --amend` — Amend the most recent commit (edit message or include new changes)  \n42. `git cherry-pick \u003ccommit\u003e` — Apply a specific commit from another branch to the current branch  \n\n43. **Rebase (interactive \u0026 advanced)**  \n   * `git rebase -i HEAD~n` — Interactively rebase the last *n* commits (replace **n** with any number)  \n   * `git rebase -i \u003cbase-commit\u003e` — Start an interactive rebase from any earlier commit  \n   * `git rebase origin/main` — Replay your local commits on top of the latest `origin/main`  \n   * `git rebase --continue / --skip / --abort` — Resume, skip, or cancel a rebase in progress  \n\n**Interactive rebase actions** (when the editor opens):\n\n| Command | Meaning |\n|---------|---------|\n| `pick` / `p` | Use the commit as is (default) |\n| `reword` / `r` | Change the commit message |\n| `edit` / `e` | Pause here to amend files or add changes |\n| `squash` / `s` | Combine this commit with the previous one and merge messages |\n| `fixup` / `f` | Combine commits, discarding this commit’s message |\n| `drop` / `d` | Remove the commit entirely |\n\n### Reset vs Revert vs Rebase — Quick Comparison\n\n| Command | What it does | When to use | Effect on history |\n|---------|--------------|-------------|-------------------|\n| `git reset --hard [commit]` | Moves branch pointer **and working tree** back to the given commit | Throw away local work and start fresh from an earlier commit | Rewrites history (local only; force-push needed to share) |\n| `git revert [commit]` | Creates a new commit that undoes changes from the specified commit | Undo a change that is already public while **preserving history** | Adds a new commit; history stays linear |\n| `git rebase` (normal or `-i`) | Re-applies commits on top of another base, optionally editing them | Clean up local commit history before pushing or integrating branches | Rewrites history; use on local or feature branches |\n\n---\n\n## Collaboration\n\n44. `git push` — Push changes to the remote repository  \n45. `git pull` — Fetch and merge changes from the remote repository  \n46. `git push --force` — Force-push changes, overwriting history  \n47. `git push --set-upstream origin [branch]` — Track a remote branch with your local branch  \n48. `git remote show origin` — Show detailed info about the remote repo  \n\n---\n\n## Tags\n\n49. `git tag [tag-name]` — Create a new tag  \n50. `git tag -a [tag-name] -m \"[message]\"` — Create an annotated tag with a message  \n51. `git tag -d [tag-name]` — Delete a local tag  \n52. `git push origin [tag-name]` — Push a tag to the remote repository  \n53. `git push origin --delete [tag-name]` — Delete a remote tag  \n\n---\n\n## Aliases \u0026 Configuration\n\n54. `git config --global alias.st status` — Create alias `st` for `git status`  \n55. `git config --global alias.co checkout` — Create alias `co` for `git checkout`  \n56. `git config --global alias.ci commit` — Create alias `ci` for `git commit`  \n57. `git config --global alias.br branch` — Create alias `br` for `git branch`  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkphamm%2Fgit-github","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkphamm%2Fgit-github","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkphamm%2Fgit-github/lists"}