Basic Commands
git init
- Initialize a new Git repositorygit clone <url>
- Clone a repositorygit status
- Show the working directory statusgit add <file>
- Add a file to the staging areagit commit -m “message”
- Commit changesgit push
- Push changes to the remote repositorygit pull
- Pull changes from the remote repository
Branching
git branch
- List branchesgit branch <name>
- Create a new branchgit checkout <name>
- Switch to a branchgit checkout -b <name>
- Create & Switch to a new branchgit merge <name>
- Merge a branch into the current branchgit branch -d <name>
- Delete a branch
Remote Repositories
git clone <url>
- Clone a repositorygit pull
- Pull changes from the remote repositorygit push
- Push changes to the remote repository
Stashing
git stash
- Stash changesgit stash list
- List stashesgit stash apply
- Apply a stashgit stash drop
- Drop a stash