doc/topics/git/advanced.md
Advanced Git operations help you perform tasks to maintain and manage your code. They are more complex actions that go beyond basic Git operations. These operations enable you to:
They provide you with the following benefits:
To use Git operations effectively, it's important to understand key concepts such as repositories, branches, commits, and merge requests. For more information, see get started learning Git.
When you use advanced Git operations, you should:
The git rebase command updates your branch with the contents of another branch.
It confirms that changes in your branch don't conflict with changes in the target branch.
If you have a merge conflict,
you can rebase to fix it.
For more information, see rebase to address merge conflicts.
The git cherry-pick command applies specific commits from one branch to another.
Use it to:
For more information, see cherry-pick changes with Git.
The following Git commands help you to revert and undo changes:
git revert: Creates a new commit that undoes the changes made in a previous commit.
This helps you to undo a mistake or a change that you no longer need.git reset: Resets and undoes changes that are not yet committed.git restore: Restores changes that are lost or deleted.For more information, see revert changes.
The size of a Git repository can impact performance and storage costs. It can differ slightly from one instance to another due to compression, housekeeping, and other factors. For more information about repository size, see repository size.
You can use Git to purge files from your repository's history and reduce its size. For more information, see reduce repository size.
You can use Git to manage files in your repository. It helps you track changes, collaborate with others, and manage large files. The following options are available:
git log: View changes to files in your repository.git blame: Identify who last modified a line of code in a file.git lfs: Manage, track, and lock files in your repository.For more information, see file management.
The git remote set-url command updates the URL of the remote repository.
Use this if:
For more information, see update Git remote URLs.