
GIT is a popular version control system used to track changes in developers code, collaborate with others, and manage different versions of a project. We can say in a simple way,
GIT is a tool that helps you to track our project history/changes in your code and work together and return to older versions when needed. This is like a saved system for your project, which has teamwork features.
Why Use Git?
- It is Free, Open Source, Super Fast and Scalable.
- It is Cheap Branching/Merging.
- Track Changes – GIT saves every version of your code so that you can undo any time.
- Team Collaboration – More than one people can work on the same project without overwriting each other’s code.
- Work on Features Separately – Create branches to test new features without affecting the main code.
- Cloud Backup – Store the code safely on platforms like Github, Gitlab – access it from anywhere.
- Project History – Keep a clear record of who changed what and when.
Daily Used Git Commands (with Examples)
1. git init
Use: Initialize a new Git repository in your project folder.
cd my-project
git init
🔹 Now .git folder is created — your project is now being tracked by Git.
2. git clone <repo-url>
Use: Copy a remote repository (like GitHub) to your local machine.
git clone https://github.com/user/project.git
🔹 It creates a folder project with all the files and Git history.
3. git status
Use: Show the current state of the working directory and staging area.
git status
🔹 Tells you which files are modified, added, or staged.
4. git add <file> or git add .
Use: Stage changes to be committed.
git add index.html
git add . # Add all changed files
🔹 Moves files from working directory ➡ staging area
5. git commit -m "message"
Use: Commit (save) the staged changes with a message.
git commit -m "Add login feature"
🔹 Moves files from staging area ➡ Git history (commit)
6. git log
Use: View the history of commits.
git log
🔹 Shows commit IDs, authors, and messages.
7. git branch
Use: List all branches or create a new one.
git branch # List
git branch feature-login # Create
8. git checkout <branch>
Use: Switch to a different branch.
git checkout feature-login
🔹 Use git switch <branch> in newer versions.
9. git merge <branch>
Use: Merge another branch into your current branch.
git checkout main
git merge feature-login
🔹 Combines changes — resolve conflicts if needed.
10. git pull
Use: Fetch changes from the remote repo and merge into your local branch.
git pull origin main
🔹 Useful when working in teams — get the latest code.
11. git push
Use: Upload local commits to the remote repository.
git push origin main
🔹 Sends your changes to GitHub or another remote server.
12. git diff
Use: Show changes between working directory and last commit.
git diff
🔹 Helps you review what you’re about to commit.
13. git reset
Use: Undo staged changes.
git reset index.html
🔹 Removes file from staging area (not from disk).
14. git stash
Use: Save changes temporarily without committing.
git stash # Save
git stash pop # Restore
🔹 Helpful if you want to switch branches but keep your uncommitted changes.
15. git remote -v
Use: Check which remote repos are linked.
git remote -v
🔹 Usually shows origin pointing to GitHub.
Daily Workflow Example
git clone https://github.com/user/project.git
cd project
# Make some changes
git status
git add .
git commit -m "Fix: update login layout"
git pull origin main # Always pull before pushing
git push origin main # Push to GitHub
Bonus Tips
- Use
.gitignoreto avoid tracking unwanted files (like.env,node_modules) - Use
git checkout -b <branch-name>to create and switch to a branch - Use
git log --onelinefor a compact commit view
Popular Git Tools Every Developer Should Know
To make working with Git easier and more visual, many developers use the following tools:
1. GitHub
A cloud-based platform for hosting Git repositories. You can collaborate, review code, manage issues, and store projects.
2. GitLab
Another Git-based platform like GitHub. It offers powerful DevOps features like CI/CD pipelines, project planning, and code reviews.
3. Bitbucket
A Git hosting service by Atlassian. Integrates well with Jira and Trello for team/project management.
4. Sourcetree
A free desktop app (by Atlassian) for managing Git repositories through a visual interface – no need to remember all commands.
🔗 https://www.sourcetreeapp.com
5. GitKraken
A powerful Git GUI with an intuitive interface, ideal for managing branches, commits, and merges visually.
6. VS Code Git Integration
Visual Studio Code has built-in Git support. You can stage, commit, push, and pull directly from the editor.
🔗 https://code.visualstudio.com
LEAVE A COMMENT
Our Services
Discover our range of professional services designed to meet your needs. We provide expert solutions with precision and excellence to help you achieve your goals.
Comments (0)
No comments yet. Be the first to comment!