A Quick Cheat Sheet for git

A Quick Cheat Sheet for git

Listing most used git commands in industry:

1. Initializing a Repository: Initializing a new Git repository with

git init.

2. Cloning a Repository: Cloning a repository to local machine with

git clone <repository URL>.

3. Basic Commands:

- Keep track of your changes with git status

- Stage files for commit with git add

- Commit changes with git commit -m "Message"

- Push your commits to a remote repository with git push

4. Branching:

- Work on new features or fixes in isolation by creating and switching branches with git branch and git checkout <branch_name>

- For a one-step solution, use git checkout -b <branch_name> to create and switch to a new branch in one go

5. Updating & Undoing:

- Stay agile with git pull to fetch and merge changes from a remote repository

- Undoing mistakes is a breeze with git reset --soft <commit>, which lets you undo commits while keeping changes staged

6. Cherry-picking: Selectively apply changes from one branch to another with git cherry-pick <commit>, perfect for incorporating specific features or fixes into your current branch.

7. History & Logging: Gain insights into your project's history with git log and examine changes with git diff.

8. Remote Repositories: Collaborate seamlessly with git remote -v to manage remote repositories, and add new remotes with git remote add <name> <URL>.

Like, share, and save this cheat sheet to level up your Git game and supercharge your development workflow.


Happy coding! ???


?? What other Git commands do you find essential? Comment below!

#IT #git #github #engineering #placements


要查看或添加评论,请登录

社区洞察

其他会员也浏览了