Learn what a commit is in GitHub with clear steps to install Git, initialize a repo, make commits, push changes, and understand commit anatomy and best practices.
Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
Step 1: Install and configure Git
git --version
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Step 2: Initialize a new Git repository
mkdir my-github-project
cd my-github-project
git init
.git
directory, where Git stores all versioning data.
Step 3: Make changes and stage them for commit
README.md
with some content:
echo "# My GitHub Project" > README.md
git status
git add README.md
Step 4: Create your first commit
git commit -m "Add initial README with project title"
Step 5: View your commit history locally
git log
commit 9fceb02d0ae598e95dc970b74767f19372d61af8
Author: Your Name <[email protected]>
Date: Mon Apr 5 10:15:30 2021 -0400
Add initial README with project title
q
to exit the log view.
Step 6: Push commits to GitHub
origin
:
git remote add origin https://github.com/your-username/your-repo.git
main
branch:
git push -u origin main
Step 7: Explore commits on GitHub’s web interface
Step 8: Understand the anatomy of a commit
Step 9: Best practices for writing commit messages
Step 10: Further exploration
git show <SHA>
to inspect a single commit in detail.When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.