GIT commands

  •  GIT CONFIGURATION

- Set name that is identifiable for credit when review version history
  • git config --global user.name "[firstname lastname]"
- Set an email address that will be associated with each history marker
  • git config --global user.email "[valid-email]"

  • GIT SETUP & INIT
  • Configuring user information, initializing and cloning repositories 
- Initialize an existing directory as a Git repository
  • git init
- Rtrieve an entire repository from a hosted location via URL

  • git clone [url]

  •  GIT STAGE
- Show modified files in working directory, staged for your next commit
  • git status

- Add a file as it looks now to your next commit (stage)
  • git add [file]

- Unstage a file while retaining the changes in working directory
  • git reset [file]

- Diff of what is changed but not staged

  • git diff 

- Diff of what is staged but not yet commited

  • git diff --staged 

- Commit your staged content as a new commit snapshot

  • git commit -m "[descriptive message]"

  • GIT BRANCH & MERGE

- List your branches

- Create a new branch at the current commit
  • git branch [branch-name]
- Switch to another branch and check it out into your working directory
  • git checkout
- Merge the specified branch's history into the current one
  • git merge [branch]
- Show all commits in the current branch's history
  • git log






Comments

Popular Posts

Laravel Hidden Eloquent Memory Leak: Why Your App Crashes with Large Data

Laravel Performance Optimization: 15 Proven Tips to Make Your App Faster (2026)

Laravel vs Node.js: Which Is Better for Web Development in 2026?