DEV Community

Susan
Susan

Posted on

DAY 5, 6 AND 7 OF JAVA FULL STACK LEARNING :

GIT :

  • Global Information Tracker[GIT].

  • Can recovery the program even the system is cracked.

  • It is a open source - licence free.

  • It is a Version Control System*[VCS]*.

  • Used to track changes in source code during software development.

  • Used by developers to maintain different version, collaborate, manage project history of code.

KEY CONCEPTS :

  1. REPOSITORY[Repo]:A directory that contains your project and its version history.

  2. COMMIT:A snapshot of your changes. You write a message to describe it.

  3. BRANCH:A separate line of development.

  4. MERGE:Combines changes from different branches.

  5. CLONE:Copy a remote repository to your local machine.

  6. PULL:Download and intergrate changes from a remote repo.

  7. PUSH:Update your changes to a local repository.

BASIC GIT COMMANDS :

1.git init - Create a new Git

2.git clone - Copy the code

3.git status - Check the status

4.git add- To track

5.git add. - Track all file

6.git restore-stage - To untrack

7.git commit-m(Message) - Save changes

8.git push - Upload to remote

9.git pull- Download changes

10.git log - Check the history(see commit)

11.git branch - List branch

12.**git checkout<branch>** - Switch a branch

13.**git merge<branch>** - Merge a branch

USES:

  • Track history.
  • Allow collaboration.
  • Supports branching and merging.
  • Work offline.
  • Open-source and fast.

GITLAB/GITHUB:

GITLAB:

  • Owned by: GitLab Inc. (open-core company)
  • Best for: DevOps teams, full CI/CD automation
  • UI/UX: Slightly more complex but powerful
  • CI/CD: Built-in GitLab CI/CD is very strong
  • Self-hosting: Easier to self-host (free Community Edition)
  • Free Private Repos: Yes

GITHUB:

  • Owned by: Microsoft
  • Best for:Open-source projects (biggest community)
  • UI/UX: More beginner-friendly
  • CI/CD: GitHub Actions (built-in)
  • Integration: Strong third-party integrations (VS Code, Azure, etc.)
  • Free Private Repos: Yes

WORKING OF GITLAB:

STEP-1:Install Gitlab.

STEP-2:Create new group.
- +(create new group[Top left])
- Create group name
- Visiblity level(Public)
- Who will use this group?
- Submit

STEP-3:New project.
- Create blank project
- Create project name
- Visiblity level(Public)
- Create project

STEP-4:Add member.
- Manage(Left middle)
- Members
- Invite members(Top right)
- Username/name/email(Can add more than 2)
- Select maximum role
- Access expire date(Optional)
- Invite

STEP-5:Clone code.
- Extract code
- Project
- code(Top right)
- Clone with SSH/HTTPS(Copy URL)
- Save(Location[optional])
- Open in terminal(Right click)
- git clone(Paste the URL)
- Enter (If"done" comes then it is clone)

STEP-6:Push code in gitlab.
- Create a new project
- git add/add.
- git commit -m
- git push

Top comments (0)