Skip to main content

Changes

warning

This document has been translated using machine translation without human review.

How to get changes from a remote repository?

From the current branch
git pull
From a specific branch
git pull origin <branch_name>

How to commit changes?

In most cases, it's enough to simply commit all changes:

Committing changes
git commit -m "Commit message"

If you need to add changes to the index:

Add a file or folder to the index
git add <file_or_dir_path>
  • <file_or_dir_path> — wildcard patterns are allowed. For example — git add *.ts.
Add all changes and ignore new files
git add -A .

How to send changes to a remote repository?

Send to the current branch
git push
Send to a specific branch
git push origin <target_branch_name>

If the target branch doesn't exist, it will be created automatically.
To track the branch, use the --set-upstream (-u) flag:

git push --set-upstream origin <target_branch_name>

Send changes for all branches and set up tracking for these branches:

git push --all --set-upstream origin

How to get the hash of the last commit, date, and branch name in one line?

This can be useful for generating a version number.

git log -1 --pretty='%H;%aI;%D'

How to check if a commit has a signature (gpg)?

git verify-commit <commit_hash>
git log --show-signature

How to get a list of all merge commits?

git log --merges --oneline --all