Restore deleted files in a Git commit
Have you accidentally deleted a file? Or maybe you need to restore a file that was deleted? Here's how Git can help you.
The Git snippet collection contains a variety of short tips and tricks for all currently maintained versions of git. It includes most commonly-used commands and covers various use-cases in the form of simplified documentation, complete with multiple examples.
Have you accidentally deleted a file? Or maybe you need to restore a file that was deleted? Here's how Git can help you.
Use the name of the current branch when pushing by default as the name of the remote branch.
Mistyping commands often? Enable Git's autocorrect feature to automatically fix them.
Prints the current branch name.
Made some changes you don't want to keep? Learn how to discard uncommitted or untracked changes in Git.
Learn how to add multiple authors to a git commit with this quick and easy tip.
Pulls all submodules from their respective remotes.
Learn how to effectively use Git's staging area, by adding or removing files from it.
Learn how to open the Git configuration file in the Git text editor, for editing.
View differences between staged or unstaged changes and the last commit in Git.
The first step is often the hardest, yet creating a Git repository is as simple as running a single command.
If you're working with a team using different operating systems, configuring line endings can help maintain consistency.
Creates a fixup commit that can be autosquashed in the next rebase.
Displays the difference between two branches.
Adds a new submodule to the repository.
Creates and switches to a new branch, optionally setting up a remote tracking branch.
Deletes a submodule from the repository.
Rebases the current branch onto another branch.
Switches to an existing branch.
Switches back to the last branch.