Git commands

Igor20.11.2023
Screenshot of Git branches

Git commands are the fundamental tools for managing version control in software development. Git is a distributed version control system that helps developers track changes in their codebase, collaborate with others, and maintain a history of their project's development.

Here are some key Git commands and their roles:

sh// Pull the latest from branch
git pull

// Stage all changes or partially
git add .
git add -p

// Commit
git commit
git commit -m "Some commit message"
git commit --amend (add to last commit)

// List branches
git branch
git branch -a

// Delete local branch
git branch -D branch-name

// Switch branch
git checkout branch-name

// Create branch
git checkout -b branch-name

// Rebase
git rebase master

// Push
git push
git push -f (force push when rebased)