0% found this document useful (0 votes)
56 views

Best Practices For Using Git

Git is an open-source version control system that supports collaborative workflows. It is well-suited for large projects with multiple contributors. Some best practices for using Git include committing regularly, keeping a consistent history, pulling updates, and rebasing branches periodically. Common Git commands include cloning a repository, checking out branches, pulling updates, viewing status and history, adding and committing changes, pushing updates, merging branches, and deleting or resetting branches.

Uploaded by

Krishan Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Best Practices For Using Git

Git is an open-source version control system that supports collaborative workflows. It is well-suited for large projects with multiple contributors. Some best practices for using Git include committing regularly, keeping a consistent history, pulling updates, and rebasing branches periodically. Common Git commands include cloning a repository, checking out branches, pulling updates, viewing status and history, adding and committing changes, pushing updates, merging branches, and deleting or resetting branches.

Uploaded by

Krishan Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Best Practices for Using Git

Why Git?

Git was designed to support various project and team setups by swiftly coordinating the
workflow on those projects. Git i is an open-source system which is used by a large
community.

Is the tool right for you and your team?

Here are some common scenarios where Git can apply:

• You are working on a large project.


• You need to collaborate with multiple people.
• You are a technology newbie.

Best practices for using Git

• Commit regularly
• Keep history consistent
• Always pull the latest updates
• Rebase your branches periodically
• Protect your project
• Choose the right developers for the job
• The more approvals, the better
• Make time tracking easier
Few commands which we use commonly

1. Clone. -> git clone <repo url>


2. Checkout -> git checkout master || git checkout -b dev origin/master
3. Pull. -> git pull || git pull <origin branch>
4. Status -> git status
5. Add -> git add . || git add <files>
6. Commit -> git commit -a
7. Commit —amend. -> git commit —-amend
8. Push. -> git push || git push <origin branch>
9. Merge -> git merge master
10. Branch -> git branch
11. Log -> git log
12. Whatchanged -> git whatchanged
13. Stash -> git stash
14. Delete Branch -> git branch -d <branchName> || git branch -D <branchName>
15. Reset Head. -> git reset --hard <commit id>
16. Rebase -> git checkout master -> git pull -> git checkout dev ->
git rebase master -> git mergetool -> git rebase —continue
git push -f

You might also like