1. Getting Started with Git: git init
Summary: Learn how to start a new Git project from scratch by initializing a local repository using git init. We’ll cover what this command does, common use cases, and how to structure your initial commits for a clean project history.
Commands:
git init
git add .
git commit -m "Initial commit"
2. Cloning Repositories: git clone
Summary: Dive into the git clone command, the go-to tool for copying remote repositories to your local machine. Understand how to clone repositories from GitHub, GitLab, and other platforms, and learn how to work with different branches during cloning.
Commands:
git clone <repository-url>
cd <repository-name>
3. Monitoring Your Changes: git status
Summary: git status is your go-to command for tracking changes in your working directory. Learn how to use this command effectively to keep your workflow clean and organized, and understand how it relates to staging and committing files.
Commands:
git status
4. Adding Files to Staging: git add
Summary: Discover how to stage files and directories using the git add command. This post will cover the basics, from adding individual files to adding everything with a single command, and common mistakes to avoid.
Commands:
git add <file-name>
git add .
5. Making Commits: git commit
Summary: Explore how to use git commit to create snapshots of your project. Learn the importance of writing clear commit messages, how to use flags like -m and --amend, and how to craft a well-documented commit history.
Commands:
git commit -m "Your commit message"
git commit --amend
6. Pushing Changes: git push
Summary: Uncover the mechanics of git push to upload your local commits to a remote repository. This post will help you understand how to manage branches, remote repositories, and handle push conflicts.
Commands:
git push origin <branch-name>
7. Pulling Updates: git pull
Summary: Learn how to use git pull to download and integrate changes from a remote repository into your local branch. This post will also explain the differences between git pull and git fetch, and how to resolve potential conflicts.
Commands:
git pull origin <branch-name>
8. Managing Branches: git branch
Summary: Discover the power of branching with git branch. We’ll cover how to create, list, rename, and delete branches, and why branches are essential for managing features, bug fixes, and releases in your projects.
Commands:
git branch <new-branch-name>
git branch -d <branch-name>
git branch
9. Switching Branches: git checkout
Summary: Understand how to use git checkout to switch between branches or revert to previous commits. This post will delve into common scenarios, like recovering from mistakes and creating new branches from existing commits.
Commands:
git checkout <branch-name>
git checkout -b <new-branch-name>
10. Merging Changes: git merge
Summary: Learn the ins and outs of git merge, from fast-forward merges to resolving conflicts. This post will explain how to integrate changes from one branch into another smoothly, and how to avoid merge pitfalls.
Commands:
git merge <branch-name>
11. Comparing Changes: git diff
Summary: Dive into git diff to compare changes between commits, branches, or your working directory. Understand how to interpret the output, track changes over time, and incorporate git diff into your daily workflow.
Commands:
git diff
git diff <commit-sha>
12. Viewing History: git log
Summary: Learn how to use git log to explore the history of your repository. We’ll cover common options, such as filtering by author or date, visualizing the commit graph, and customizing the output for better readability.
Commands:
git log
git log --oneline
git log --graph --decorate --all
Happy coding! 🚀
Advance Commands : https://dev.to/uicraft_by_pratik/git-mastery-medium-level-commands-to-elevate-your-workflow-1ijc
LinkedIn : https://www.linkedin.com/in/pratik-tamhane-583023217/
Behance : https://www.behance.net/pratiktamhane