git

Basic Commands

  • git init - Initialize a new Git repository
  • git clone <url> - Clone a repository
  • git status - Show the working directory status
  • git add <file> - Add a file to the staging area
  • git commit -m “message” - Commit changes
  • git push - Push changes to the remote repository
  • git pull - Pull changes from the remote repository

Branching

  • git branch - List branches
  • git branch <name> - Create a new branch
  • git checkout <name> - Switch to a branch
  • git checkout -b <name> - Create & Switch to a new branch
  • git merge <name> - Merge a branch into the current branch
  • git branch -d <name> - Delete a branch

Remote Repositories

  • git clone <url> - Clone a repository
  • git pull - Pull changes from the remote repository
  • git push - Push changes to the remote repository

Stashing

  • git stash - Stash changes
  • git stash list - List stashes
  • git stash apply - Apply a stash
  • git stash drop - Drop a stash