Working on a project that requires an emulation layer for the Git command line interface would require you to know your way around using Git Bash. In this article, I will be breaking down how to install Git Bash, some Git commands you should be familiar with and how to set up a local repository with Git.
TABLE OF CONTENTS
- What Git Bash is and how to utilize it
- Installing Git Bash
- Git Commands
- How to set up your local repository with Git
- Git Bash paste instructions
For Microsoft Windows environments, Git Bash is a program that offers an emulation layer for the Git command line interface. The abbreviation BASH stands for Bourne Again Shell. An operating system can be accessed by written commands using a shell and a terminal program. Popular default shells for Linux and macOS are bash. On a Windows operating system, Git Bash is a package that installs Bash together with a few standard bash utilities.
Go to the official website to download the Git Bash setup: https://git-scm.com/
After downloading, run the installer.
Select the components you need to install, launch the.exe file, and follow the installer's instructions.
After the installation process has finished, you can launch Git Bash either by using the
cmd command on your system search or right-clicking in any folder and choosing the Git Bash Here option from the context menu.
To print the "current working directory," use the Bash command
pwd. On a DOS (Windows console host) terminal, typing
pwd is the equivalent of typing cd. The current Bash session is located in this folder or directory.
To 'list' the contents of the active working directory, use the Bash command
ls. On a Windows console host terminal,
ls is the equivalent of DIR.
ls to list the contents of the current directory.
cd command in both Bash and Windows console host. Change Directory is referred to as
cd. An added directory name is used when using
cd changes the working directory of the terminal session to the directory specified by the passed directory argument.
git config --global user.name
This comment will set your name.
git config --global user.email
This comment will set your email.
Create a new blank repository and initialize an existing directory as a git repository.
Changes are saved to the local repository.
Displays the status of the working directory and the staging area.
Manage the set of remotes that you are tracking with your local repository.
Match your working directory with your last commit.
Shows the commit history for your current active branch.
Fetches and merges on the remote server to your working directory.
Changes the master branch to your remote repository.
Merges the specific branches history into the current branch.
Remove your file from your working directory and git staging area.
Shows changes between commits.
Creates a blank file inside your folder.
git add -a
Add all modified and deleted files only to the staging area.
git checkout -f
Match all your working directory file with your last commit.
git log -p
See any particular "one" or more than one commit.
git diff --staged
Compares the staging area to the last commit.
git rm --cached
Removes your file from the staging area.
git branch -b
Creates a new branch and opens that particular branch.
follow the steps below:
Make a GitHub repository.
Give your repository a good name and create the repository.
Note: You can choose to include information about your project in the README file that comes at the top of your git repository. It helps give vital information about your project. However, it is not strictly required. If you start your repository with a README file using the GitHub interface, your local repository won't have this README file. To prevent encountering an issue while attempting to push your files (as in step 3 of the following section), carry out the following steps to pull that file to your local folder after step 5 (where you setup your local folder as your git repository):
### STEP 3
The following will show up following repository creation.
Open Git Bash and use the cd command followed by the name of the project to move to the local project.
Create a Git repository in the local directory.
Before the initial commit, stage the files by adding them to the local repository using (
git add .)
The staged files can be seen with "git status"
The files you've staged in your local repository should now be committed using ( git commit -m "commit message" )
Consider one of the following options:
Press the Insert+Shift button.
Using the mouse, do the following: Right Click -> Edit -> Paste
Enable the "Quick Edit" mode and use the Ctrl+V shortcut as usual:
Right-click and choose "Properties."
Choose the "Options" tab.
Check the box next to "Quick Edit Mode."
If a "Experimental" tab appears, select it and then check the top "Enable experimental console" and "Enable new Ctrl key shortcuts" options.
To save, click 'OK.'
You can now paste using Ctrl+V.
We were successful in covering Git Bash at a beginner's level and how to use it. When using Git Bash, the commands will be useful.
This has been a long read, if you made it this far then I genuinely hope you find the information useful.
I appreciate your time.