What is Git Bash?
It is an application for Microsoft Windows environments that offers an emulation layer for a Git command-line experience. Also valid on Linux and MacOS.
You can install it on GITBASH.
A Git repository is a virtual storage of your project. It allows you to save versions of your code that you can access when you need it.
The main commands for handling a repository using GitBash in your GitHub or GitLab projects are:
Let’s imagine we have a project called “Proyecto”, to operate on it, we must do the following, first position ourselves within the project, and then press “Right button > Git Bash Here”. The console will open and we can start working on it:
Within our project we do the following:
- Starting a new repository: git init
- We clone the project from where we have it, whether it’s on GitHub or GitLab (for example). We copy the route that is in “Clone with HTTPS”, and then in the console we would type: git clone + paste the route we just copied.
- Adding changes: git add .
- Creating a message that describes what we are going to add: git commit -m “new changes task x completed”
- Downloading changes: git pull origin master
- Uploading changes: git push origin master
IMPORTANT! Before uploading any changes, we must download them, so that no conflicts are created.
These commands are basic and necessary to be able to work simultaneously on a project with more participants in git.
I hope it is helpful for you, until next time.😉