Push and Pull
1 Check the Current State of the Repository
See what files have been changed, added, or deleted since the last local edit. This helps you verify what changes you are going to stage.
git status
2 Commit Your Work
Save a snapshot of the staged changes with a meaningful message describing what you did.
git add .
git commit -m "your message here"
3 Push to Remote
Upload your local commits to the remote repository so others can see and build on your changes.
git push origin main
You can also replace main
with your branch name.
Push Isn’t Automatic
Even after you commit, your changes are still local.
You must manually push
to send them to GitHub.
4 Pull from Remote
Download and merge the latest changes from the remote repository to keep your local copy up to date.
git pull
Pull Might Trigger Merge Conflicts
If your teammates or other collaborators made changes to the same files, Git might ask you to resolve a conflict before finishing the pull.