Tuesday, 4 June 2024

Devops : List of basic git commands

Hello Friend's, In this blog we will learn some basic git commands should know all developer and Devops engineer.

Here's a list of commonly used Git commands

1. git init: Initialize a new Git repository.

2. git clone [url]: Clone a repository from a remote server.

3. git add [file]: Add file(s) to the staging area.

4. git commit -m "[message]": Commit changes with a descriptive message.

   -m represents the message of your commit

5. git status: Show the current status of the repository.

6. git diff: Show the differences between the working directory and the staging area.

7. git diff --staged: Show the differences between the staging area and the last commit.

8. git push: Push changes to a remote repository.

9. git pull: Fetch and merge changes from a remote repository to the local repository.

10. git fetch: Fetch changes from a remote repository without merging.

11. git merge [branch]: Merge a branch into the current branch.

12. git branch: List all branches in the repository.

13. git checkout [branch/tag/commit]: Switch branches or restore working tree files.

14. git log: Display commit history.

15. git remote -v: List remote repositories and their URLs.

16. git remote add [name] [url]: Add a new remote repository.

17. git reset [file]: Unstage file(s) from the staging area.

18. git revert [commit]: Revert a commit by applying a new commit.

19. git stash: Stash changes in a dirty working directory away.

20. git branch -d [branch]: Delete a branch.


These are just some of the basic Git commands. Let me know if you have any specific questions or if there's something else you'd like to learn about Git!

Thanks for reading, Yours friend VK😊

No comments:

Post a Comment

Introduction to k8s

 Hello friends, Good Day! Hope you guys are doing well, I am writing here some basic terminology n introduction to kube8.. please do read n ...