githubEdit

Github command cheatsheet

  1. git init: Initialize a new Git repository.

  2. git clone <repository-url>: Clone a repository onto your local machine.

  3. git add <file>: Add file changes to the staging area.

  4. git commit -m "message": Commit staged changes to the repository.

  5. git push <remote> <branch>: Push committed changes to a remote repository.

  6. git pull <remote> <branch>: Fetch changes from a remote repository and merge them into the current branch.

  7. git branch: List, create, or delete branches.

  8. git checkout <branch>: Switch between branches or restore working tree files.

  9. git merge <branch>: Merge changes from one branch into another.

  10. git status: Show the current status of the repository.

  11. git log: Display commit history.

  12. git remote: Manage remote repositories.

  13. git fetch <remote>: Download objects and refs from another repository.

  14. git stash: Temporarily shelve changes.

  15. git revert <commit>: Revert commits.

  16. git config: Configure Git settings.

  17. git tag: Create, list, delete, or verify tags.

  18. git reset: Reset current HEAD to the specified state.

  19. git rm <file>: Remove files from the working tree and the index.

  20. git mv <old-path> <new-path>: Move or rename a file, directory, or symlink.

  21. git show: Show various types of objects.

  22. git blame: Show what revision and author last modified each line of a file.

  23. git diff: Show changes between commits, commit and working tree, etc.

  24. git fetch: Download objects and refs from another repository.

  25. git rebase: Reapply commits on top of another base tip.

  26. git cherry-pick <commit>: Apply the changes introduced by some existing commits.

  27. git bisect: Find by binary search the change that introduced a bug.

  28. git grep <pattern>: Print lines matching a pattern.

  29. git archive: Create an archive of files from a named tree.

  30. git submodule: Initialize, update or inspect submodules.

  31. git clean: Remove untracked files from the working tree.

  32. git reflog: Manage reflog information.

  33. git difftool: Show changes using common diff tools.

  34. git mergetool: Run merge conflict resolution tools to resolve conflicts.

  35. git fetch --prune: Remove any remote-tracking references that no longer exist on the remote.

  36. git remote show <remote>: Show information about a given remote.

  37. git shortlog: Summarize 'git log' output.

  38. git describe: Show the most recent tag that is reachable from a commit.

  39. git revert --no-commit: Revert changes, but don't create a new commit.

  40. git push --force: Forcefully push commits to a remote repository.

Last updated