Git Commands

Sadat Mahmud
0

 




 list of the top 10 essential Git commands along with short descriptions for each:

  1. git clone: This command is used to copy an existing Git repository from a remote server to your local machine. It’s the first step in working with code from a repository.

    git clone <repository-url>
    
  2. git branch: It allows you to manage branches in your repository. You can create, list, and delete branches with this command.

    git branch <branch-name> # Create a new branch
    git branch -d <branch-name> # Delete a branch
    
  3. git checkout: This command is used to switch between branches or restore working tree files.

    git checkout <branch-name> # Switch to a branch
    git checkout -b <branch-name> # Create and switch to a new branch
    
  4. git status: It shows the status of changes as untracked, modified, or staged.

    git status
    
  5. git add: This command adds changes in the working directory to the staging area. It tells Git that you want to include updates to these files in the next commit.

    git add <file-name>
    git add . # Add all changes
    
  6. git commit: It captures a snapshot of the project’s currently staged changes. This command commits your staged content as a new commit snapshot.

    git commit -m "Commit message"
    
  7. git push: This command is used to upload local repository content to a remote repository. It’s how you transfer commits from your local repository to a remote repo.

    git push <remote> <branch>
    
  8. git pull: It fetches and downloads content from a remote repository and immediately updates the local repository to match that content.

    git pull <remote>
    
  9. git merge: This command combines multiple sequences of commits into one unified history. It’s typically used to combine a feature branch into the main branch.

    git merge <branch-name>
    
  10. git diff: It shows the differences between two sources, such as branches, commits, files, etc. It’s a great way to see what changes have been made.

    git diff # Show changes between commits, commit and working tree, etc.
    

These commands are fundamental for everyday Git operations, helping you manage and track the progress of your projects efficiently. Remember, the angle brackets < > indicate where you should provide your own specific information, like the URL of a repository or the name of a branch.


āĻāĻ•āĻŸি āĻŽāĻ¨্āĻ¤āĻŦ্āĻ¯ āĻĒোāĻ¸্āĻŸ āĻ•āĻ°ুāĻ¨

0āĻŽāĻ¨্āĻ¤āĻŦ্āĻ¯āĻ¸āĻŽূāĻš

āĻāĻ•āĻŸি āĻŽāĻ¨্āĻ¤āĻŦ্āĻ¯ āĻĒোāĻ¸্āĻŸ āĻ•āĻ°ুāĻ¨ (0)