GitHub - 30 GitHub commands used by every DevOps Engineer

H A R S H H A A - Jul 17 - - Dev Community

Introduction:

Git & GitHub has steadily risen from being just a preferred skill to a must-have skill for multiple job roles today. In this article, I will talk about the Top 30 Git Commands that you will be using frequently while you are working with Git.

🌐 Essential GitHub Commands Every DevOps Engineer Should Know

1. git init

🛠️ Description: Initializes a new Git repository in the current directory.

2. git clone [url]

🛠️ Description: Clones a repository into a new directory.

3. git add [file]

🛠️ Description: Adds a file or changes in a file to the staging area.

4. git commit -m "[message]"

🛠️ Description: Records changes to the repository with a descriptive message.

5. git push

🛠️ Description: Uploads local repository content to a remote repository.

6. git pull

🛠️ Description: Fetches changes from the remote repository and merges them into the local branch.

7. git status

🛠️ Description: Displays the status of the working directory and staging area.

8. git branch

🛠️ Description: Lists all local branches in the current repository.

9. git checkout [branch]

🛠️ Description: Switches to the specified branch.

10. git merge [branch]

🛠️ Description: Merges the specified branch's history into the current branch.

11. git remote -v

🛠️ Description: Lists the remote repositories along with their URLs.

12. git log

🛠️ Description: Displays commit logs.

13. git reset [file]

🛠️ Description: Unstages the file, but preserves its contents.

14. git rm [file]

🛠️ Description: Deletes the file from the working directory and stages the deletion.

15. git stash

🛠️ Description: Temporarily shelves (or stashes) changes that haven't been committed.

16. git tag [tagname]

🛠️ Description: Creates a lightweight tag pointing to the current commit.

17. git fetch [remote]

🛠️ Description: Downloads objects and refs from another repository.

18. git merge --abort

🛠️ Description: Aborts the current conflict resolution process, and tries to reconstruct the pre-merge state.

19. git rebase [branch]

🛠️ Description: Reapplies commits on top of another base tip, often used to integrate changes from one branch onto another cleanly.

20. git config --global user.name "[name]" and git config --global user.email "[email]"

🛠️ Description: Sets the name and email to be used with your commits.

21. git diff

🛠️ Description: Shows changes between commits, commit and working tree, etc.

22. git remote add [name] [url]

🛠️ Description: Adds a new remote repository.

23. git remote remove [name]

🛠️ Description: Removes a remote repository.

24. git checkout -b [branch]

🛠️ Description: Creates a new branch and switches to it.

25. git branch -d [branch]

🛠️ Description: Deletes the specified branch.

26. git push --tags

🛠️ Description: Pushes all tags to the remote repository.

27. git cherry-pick [commit]

🛠️ Description: Picks a commit from another branch and applies it to the current branch.

28. git fetch --prune

🛠️ Description: Prunes remote tracking branches no longer on the remote.

29. git clean -df

🛠️ Description: Removes untracked files and directories from the working directory.

30. git submodule update --init --recursive

🛠️ Description: Initializes and updates submodules recursively.


Thank you for reading my blog …:)

© Copyrights: ProDevOpsGuy

Join Our Telegram Community || Follow me for more DevOps & Cloud Content

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .