DEV Community

ruchikaatwal
ruchikaatwal

Posted on • Updated on

Git - Beginner's Guide

  • Git

Git is version control system used to handle small to very large projects efficiently.

Git helps in tracking changes in the source code, enabling multiple developers to work together on non-linear development.

Installing git on ubuntu

  • Update packages
sudo apt update
Enter fullscreen mode Exit fullscreen mode
  • Install git
sudo apt install git
Enter fullscreen mode Exit fullscreen mode
  • Confirm that you have installed Git correctly by running the following command :
git --version
Enter fullscreen mode Exit fullscreen mode

Push your first project folder to git server

  • How to initialiaze git in local system

After this command it will create empty git directory under current directory.

init git
Enter fullscreen mode Exit fullscreen mode
  • Staging

After initiate git, now check what files are there for stating area. File have have added or not. If file not added to staging it will show filename as red color.

git status
Enter fullscreen mode Exit fullscreen mode
  • Add to staging
#### to add single file or folder
git add filename
Enter fullscreen mode Exit fullscreen mode
#### to add all file and folder
git add .
Enter fullscreen mode Exit fullscreen mode

After adding you can check status by git status, file is added to staging or no.

And then now we need to commit changes.

Note:. Add will only add in the queue, it will not be added to versioning, after commit it will be added to version control.

  • Commit
git commit -m "this helps to track changes readble easy,  so write what changes you made"
Enter fullscreen mode Exit fullscreen mode

Top comments (0)