Git Commands
Commands | Description |
---|---|
git init |
Initialize a git repository |
git status |
Basic details like current branch, untracked files etc |
git log |
Details like commit hash, author name, commit date etc |
1. git add file_name 2. git add . |
1. Stage specific file 2. Stage all files in current folder |
1. git reset file_name 2. git reset HEAD -- . 3. git reset |
1. Unstage specific file 2. Unstage all file in current folder and its subfolders 3. Unstage all files in the project |
git commit [option] 1. -q 2. -v 3. -F <file> 4. --author <author> 5. -m <message> 6. --reset-author 7. -e 8. --status 9. -a 10. --interactive 11. -p 12. --dry-run 13. --branch |
Commit staged changes 1. suppress summary after successful commit 2. show diff in commit message template 3. read message from file 4. override author for commit 5. commit message 6. the commit is authored by me now (used with -C/-c/--amend) 7. force edit of commit 8. include status in commit message template 9. commit all changed files 10. interactively add files 11. interactively add changes 12. show what would be committed 13. show branch information |
git remote [options] 1. -v 2. add <name> <url> 3. rename <old> <new> 4. remove <name> 5. set-head <name> (-a / -d / <branch>) 6. show [-n] <name> 7. prune [-n / --dry-run] <name> 8. -v update [-p] [(<group> / <remote>)...] 9. set-branches [--add] <name> <branch>... 10. get-url [--push] [--all] <name> 11. set-url [--push] <name> <newurl> [<oldurl>] 12. set-url --add <name> <newurl> 13. set-url --delete <name> <url> |
Git remote operations 1. verbose 2. add a remote with given name 3. rename remote name 4. remove remote locally 5. Sets or deletes the default branch (i.e. the target of the symbolic-ref refs/remotes/\ 6. print details about remote 7. Deletes stale references associated with \ 8. Fetch updates for remotes or remote groups in the repository as defined by remotes.\ 9. Changes the list of branches tracked by the named remote 10. Retrieves the URLs for a remote. By default, only the first URL is listed. 11. Changes push URLs for the remote. If \ 12. Instead of changing existing URLs, new URL is added. 13. All URLs matching regex \ |