Configure Git (one-time setup):
Initialize a Repository:
.git folder in your project directory.See which files are modified, staged, or untracked:
Add files to the staging area:
Save staged changes to your local repository:
See the commit history:
Add a remote repository (e.g., GitHub):
Push changes to the remote repository:
Pull changes from the remote repository:
Copy a remote repository to your local machine:
Why use branches?
Create a Branch:
Merge a Branch:
Undo Changes:
bash git reset --soft HEAD~1bash git restore <file>Resolve Merge Conflicts:
If Git reports conflicts during a merge, manually edit the conflicting files, then:
Recap:
git add, git commit, git push, and git pull.Practice makes perfect: