Home » Git is a popular version control system used by both administrators and developers to manage code and collaborate on software projects.

Git is a popular version control system used by both administrators and developers to manage code and collaborate on software projects.

Git is a popular version control system used by both administrators and developers to manage code and collaborate on software projects. Here are some common commands used by both roles:

Common Git Commands for Developers
Common Git Commands for Developers

Common Git Commands for Developers:

  1. git clone: Copies a repository from a remote server to your local machine. Example: git clone <repository_url>
  2. git add: Adds changes in your working directory to the staging area, preparing them for a commit. Example: git add <file> or git add . (to add all changes)
  3. git commit: Creates a new commit with the changes from the staging area. Example: git commit -m "Commit message"
  4. git push: Uploads local commits to a remote repository. Example: git push origin <branch_name>
  5. git pull: Fetches and merges changes from a remote repository to your local branch. Example: git pull origin <branch_name>
  6. git status: Shows the current status of your working directory and staging area.
  7. git log: Displays the commit history for the current branch.
  8. git branch: Lists all branches in the repository. Example: git branch or git branch -a (to show all branches, including remote ones)
  9. git checkout: Switches to a different branch or commit. Example: git checkout <branch_name> or git checkout <commit_hash>
  10. git merge: Integrates changes from one branch into another. Example: git merge <branch_name>
  11. git stash: Temporarily stores changes that are not ready to be committed. Example: git stash or git stash save "message"

Common Commands for Administrators:

  1. git init: Initializes a new Git repository in the current directory.
  2. git remote: Manages connections to remote repositories. Example: git remote add <name> <repository_url>
  3. git fetch: Downloads objects and refs from another repository. Example: git fetch origin
  4. git push: Uploads local commits to a remote repository. Example: git push origin <branch_name>
  5. git pull: Fetches and merges changes from a remote repository to the current branch. Example: git pull origin <branch_name>
  6. git clone: Copies a repository from a remote server to your local machine. Example: git clone <repository_url>
  7. git log: Displays the commit history for the current branch.
  8. git branch: Lists all branches in the repository. Example: git branch or git branch -a (to show all branches, including remote ones)
  9. git checkout: Switches to a different branch or commit. Example: git checkout <branch_name> or git checkout <commit_hash>
  10. git merge: Integrates changes from one branch into another. Example: git merge <branch_name>
  11. git tag: Creates, lists, or deletes tags to mark specific points in history. Example: git tag <tag_name> or git tag -a <tag_name> -m "Tag message"

These commands provide a starting point for using Git effectively as both an administrator and a developer. There are many other advanced commands and workflows that you can explore as you become more comfortable with Git.

0 0 votes
Article Rating