Most Important Gitlab Commands

1. git clone: clones a repository to your local machine.

2. git init: initializes a new Git repository.

3. git add: stages a file for commit.

4. git commit -m ": commits staged changes with a message.

5. git push: pushes committed changes to a remote repository.

6. git pull: pulls changes from a remote repository to your local repository.

7. git fetch: fetches changes from a remote repository to your local repository.

8. git branch: lists all the branches in the repository.

9. git checkout: switches to the specified branch.

10. git checkout -b: creates a new branch and switches to it.

11. git merge: merges the specified branch into the current branch.

12. git diff: shows the differences between two commits, branches or files.

13. git log: shows the commit history of the repository.

14. git status: shows the status of the repository, including which files are staged and which are not.

15. git stash: temporarily saves changes that are not yet ready to be committed.

16. git stash pop: applies the most recent stash to the repository.

17. git reset: unstaged a file from the commit.

18. git reset --hard: discards all changes since the last commit.

19. git revert: creates a new commit that undoes the changes introduced by the specified commit.

20. git rm: removes a file from the repository.

21. git mv: renames a file in the repository.

22. git tag: lists all the tags in the repository.

23. git tag: creates a new tag.

24. git push --tags: pushes all the tags to the remote repository.

25. git show: shows the changes introduced by the specified commit.

26. git blame: shows who made each change to the specified file.

27. git cherry-pick: applies the changes introduced by the specified commit to the current branch.

28. git rebase: applies the changes made in the specified branch to the current branch.

29. git remote: lists all the remote repositories.

30. git remote add: adds a new remote repository.

31. git remote remove: removes a remote repository.

32. git push: pushes changes to the specified remote repository and branch.

33. git push --force: forces a push to a remote repository, overwriting any changes.

34. git pull --rebase: pulls changes from a remote repository and applies them on top of the current branch.

35. git clone --depth=1: clones a repository without its entire history.

36. git clone: clones a repository into a specific directory.

37. git submodule init: initializes submodules in the repository.

38. git submodule update: updates submodules in the repository.

39. git config --global user.name: sets the global username for Git.

40. git config --global user.email: sets the global email address for Git.

41. git config --global core.editor: sets the default text editor for Git

Leave A Comment