Revanth Vermareddy
Git Commands to Remember
🔗Git
-
Here are some common Git commands
git init
: creates a new Git repositorygit clone <url>
: clone a remote Git repository to a local machinegit add <file>
: add a file to the staging areagit add .
: add all changes to the staging areagit commit -m "message"
: commit changes to the repository with a messagegit push
: push committed changes to a remote repositorygit pull
: pull changes from a remote repository to a local repositorygit status
: display the current status of the repositorygit log
: display the commit historygit branch
: list all the branches in the repositorygit checkout <branch>
: switch to a different branchgit merge <branch>
: merge changes from a different branch into the current branchgit diff
: display the differences between two commits or branches
-
Here are some git stash commands
git stash
: stashes changes in the working directory, saving them for later usegit stash list
: lists all stashes in the repositorygit stash apply
: applies the most recently created stash to the current branchgit stash apply <stash>
: applies a specific stash to the current branchgit stash pop
: applies the most recently created stash to the current branch and removes it from the stash listgit stash pop <stash>
: applies a specific stash to the current branch and removes it from the stash listgit stash drop
: removes the most recently created stash from the stash listgit stash drop <stash>
: removes a specific stash from the stash listgit stash clear
: removes all stashes from the stash list