Oct 4, 2024
Installation:
git --version
Configuration:
git config --global user.name 'Your Name'
git config --global user.email 'your.email@example.com'
Creating a Repository:
git init
main
)git status
to check tracked and untracked filesgit add [file]
or git add .
(adds all files)git commit -m 'commit message'
git log
git checkout [commit hash]
git remote add origin [repository URL]
git push -u origin main
git branch [branch name]
git checkout [branch name]
git merge [branch name]
git reset
can be used to move back in commit historygit revert [commit hash]
creates a new commit that undoes changes without losing historygit stash
saves changesgit stash apply
brings back saved changes