Welcome to the Developer's Corner! 🚀 Dive into the heart of efficient version control with our latest blog post, where we unravel the key Git commands and terminology essential for every developer. Whether you're a coding maestro or just starting your programming journey, this comprehensive guide is your passport to mastering the intricacies of Git. Let's embark on a journey of streamlined collaboration, error-free code management, and a deeper understanding of version control. Gear up for an insightful exploration that will elevate your coding prowess! 💻✨ #GitCommands #DeveloperGuide #CodingMastery
Commands
-
git config
-to get and set Git configuration variables
-
git config --global user.name "Your Name"
-to set your user name
-
git config --global user.email "your.email@example.com"
-to set your user email
-
git config user.name
-to get you user name
-
git config user.email
-to get you user email
-
git config --list
-list all git configurations
-
git config --global --edit
-to edit the Git configuration file directly
-
git init
-This command initializes a new Git repository in the current directory.
-
git add filename.txt
-adds the specific file changes to the staging area
-
git add .
-adds all changes in the current directory and its subdirectories to the staging area in Git
-
git add -p
-to interactively choose which changes to add to the staging area
-
git add --all :/ -:(filename.txt)
-Add all changes but exclude some files:
-
git rm filename.text
-removes the specified file from both your working directory and the staging area.
-
git commit -m “Your commit message”
-to save the changes that have been added to the staging area
-
git clone <repository_url>
-to create a copy of a remote Git repository on your local machine
-
git clone -b branch_name <repository_url>
-to clone a repository from a specific branch,
-
git fetch
-It retrieves new branches, updates remote-tracking branches, and brings in the changes to your local repository.
-
git pull <remote_name> <branch_name>
-to fetch and merge changes from a remote repository into your current branch
-
git push <remote_name> <branch_name>
-to upload local repository content to a remote repository.
-
git push -u <remote_name> <branch_name>
-to push and set the default remote branch for future pushes.
-
git push
-to push the changes to default remote branch
-
git push <remote_name> <local_branch_name>:<remote_branch_name>
-to push a specific local branch to a different remote branch
-
git push --all <remote_name>
-pushes all local branches to the remote repository
-
git push <remote_name> --delete <branch_name>
-to delete a remote branch
-
git push --force <remote_name> <branch_name>
-forcefully updates a remote branch, potentially overwriting conflicting changes with caution to avoid data loss.
-
git remote
-lists the names of the remote repositories associated with your local repository
-
git remote -v
-shows the full URLs of remote repositories along with their names
-
git branch -r
-to view all remote-tracking branches in your local Git repository
-
git remote add <name> <url>
-adds a new remote repository
-
git remote remove <name>
-removes the remote repository with the specified name from your configuration
-
git remote rename <old_name> <new_name>
-renames a remote repository
-
git remote show <name>
-shows information about a specific remote repository, including the URL and branches
-
git branch
-lists all the branches in your local repository.
-
git branch <branch_name>
-creates a new branch with the specified name
-
git checkout <branch_name>
-switches to the specified branch
-
git checkout -b <branch_name>
-create and switches to the new branch
-
git branch -d <branch_name>
-deletes the specified branch
-
git branch -m <old_branch_name> <new_branch_name>
-renames the specified branch
-
git merge <source_branch>
-merges changes from [ source_branch ] into the current branch
-
git log
-shows a log of all commits in the repository, including their commit messages and unique identifiers
-
git log --summary
-provides a more detailed summary of each commit, including a list of changed files and the changes made to each file
-
git status
-gives a quick overview of changes in the working directory, files staged for the next commit, and untracked files in your Git repository
Top comments (0)