Git Bash Commands
Introduction:
Git Bash is a command-line interface for version control using Git. It provides a command-line interface for interacting with the Git repository. It is available on Windows, Linux, and macOS, and can be used to perform a variety of tasks, such as initializing a new repository, committing changes, merging branches, and more.
To View the printable PDF of this sheet
Some of the most commonly used Git Bash commands include:
git init
: Initializes a new Git repository in the current directorygit clone
: Creates a copy of a remote repository on your local machinegit add
: Adds changes to the staging area, ready for committinggit commit
: Creates a new commit with the changes in the staging areagit status
: Shows the status of the files in the repository, including changes that have been made but not yet committedgit diff
: Shows the differences between the changes that have been made but not yet committed and the last committed versiongit log
: Shows a history of all the commits in the repositorygit branch
: Shows a list of branches in the repository and the current branch you are ongit merge
: Merges changes from one branch into anothergit pull
: Fetches changes from a remote repository and merges them into the local repositorygit push
: Pushes local commits to a remote repository.
These are just a few examples of the many commands available in Git Bash. It’s important to note that Git Bash commands are case-sensitive and must be typed exactly as they are written.
Git Bash is a command-line interface for version control using Git. It provides a wide range of commands that can be used to perform various tasks such as initializing a new repository, committing changes, merging branches, and more. The most commonly used Git Bash commands include git init
, git clone
, git add
, git commit
, git status
, git diff
, git log
, git branch
, git merge
, git pull
, and git push
. It’s important to note that Git Bash commands are case-sensitive and must be typed exactly as they are written. Understanding and utilizing these commands can help developers effectively manage their code and collaborate with others.