Git Commands
Git commands allow you to manage code versions, track changes, collaborate, and maintain project history efficiently.
Gitlab Commands
GitLab uses standard Git commands for managing repositories, branches, commits, and collaboration. Mastering these commands is crucial for efficient version control and CI/CD workflows.
git init
It is used to initialize a directory, So Git tracks it as a repository. a .git file with configuration and log files is added to the directory. You shouldn’t edit the .git file directly.
git add
It is used to add files to the first step of staging area. You can recursively stage changes from the current working directory with git add . or stage all changes in the Git repository with git add --all.
git clone
It is used to copy an existing Git repository for backup.
git commit
It is used to commit staged changes to the repository. By using git commit -- m"..." inside the " " is the commit message it displayed in the project Repository.
git diff
It is used to view the differences between your local unstaged changes and the latest version that you cloned or pulled.
git push
It is used to push the files to the repository.
git pull
It is used to get all the changes made by users after the last time you cloned or pulled the project.
git remote add
It is used to tell Git which remote repository in GitLab is linked to a local directory.
-
git status
It is used to show the status of the working directory and staged files. When you add, change, or delete files, Git can show you the changes.
Top comments (0)