Initialize a Repository
Bash Commands
Bash is a command line interface (CLI) used on UNIX style systems (Mac and Linux).
If you're using a Mac, these commands can be used in the standard Terminal. The standard Windows Command Prompt uses different commands.
Fortunately for Windows users, installing Git also installs Git Bash, a UNIX style CLI. This means we can use Bash commands on Windows!
The following list offers a concise overview of the essential Bash navigation commands.
Command | Description |
---|---|
pwd | Current directory filepath |
ls | List all files in current directory |
cd | Change directory (ex. cd DirectoryName ) |
cd .. | Change to parent directory |
Initializing a repository
When we are ready to start our project, we move to the project folder using the command line. Then type git init
to initialize an empty Git repository on your computer.
# Move to project folder
cd my_project
# Initialize repository
git init
Checking the status of the repository
To get a list of the repository's current status, which will include untracked, modified, and staged files, we would use the git status
command from within the project folder.
# Check the status of the repository
git status