DEV Community

LAKSHMI G
LAKSHMI G

Posted on

How I Learned to Push Code to GitLab – Step-by-Step Guide for Beginners

Yesterday, I learned how to push my first code to GitLab using Git!

Step-by-Step Git Commands I Used:

1.Check the Git Status:
git status - This command shows which files are changed or not added yet.

2.Track Files Using git add:
git add filename - This command shows exact file we want to push.
git add . - This command shows to add everything

3.** Commit the Changes:**
git commit -m "Your message here" - This command saves your changes in the local Git repository.

4.** Set Up Git (First-Time Only):**
git config --global user.name "Your Name"
git config --global user.email "you@example.com"

6.Push Your Code:
git push - This command show your username and password.

7.** Short key for git commands and purpose:**
git status - Check what's happening
git add - Track changes
git commit - Save a version
git push - Upload to GitLab
git restore - Undo added files

This was my first time pushing code to GitLab, and it felt great to see my project live in the repository. I now understand the Git flow better and feel more confident using the terminal.

Top comments (0)