Essential Git Commands

Once you have Git installed on your computer, you can clone projects from developer communities like Github or Gitlab, would it be an existing, forked or newly created project. In the command line run the following code:

git clone

Alternatively, you can only include your username to be prompted to enter the password:

git clone

After having made changes to the project, you can push them back into the master branch or create a new branch for development:

git checkout -B develop

If you run the command below, you will see that now you have 'master' and 'deveop' branches and you are currently switched to the 'develop' branch:

git branch

Here is how you can switch back to the master branch:

git checkout master

Now you need to add the changes you have made to the project to the staging process with the following command:

git add .

To commit the changes run the code below, including a short description for your commit:

git commit -m "commit description"

Finally, to push the changes execute the following command by specifying the destination branch at the end:

git push -u origin develop

> Next Article

< Home Page

Technologies: Git

VAIDOTASWEB.COM Blog provides simple to complex tutorials on topics like Web Development, Operating Systems, Graphic Design, Audio Equipment, etc.

Disclaimer: tutorials provided in this blog are intended for informational purposes. End results may vary depending on factors like different operating systems, software versions, etc.