Answer:
Git is a distributed version control system that allows multiple developers to work on a project simultaneously, keeping track of changes in code.
Answer:
GitHub is a web-based hosting service that uses Git for version control. It provides a platform for collaboration, code sharing, and project management.
Answer:
Git is the version control system itself, while GitHub is a web-based platform built around Git that provides additional collaboration features.
Answer:
Git offers features such as decentralized development, easy branching and merging, version control, and offline capabilities.
Answer:
You can create a Git repository by using the "git init" command in the desired project directory.
Answer:
A commit represents a snapshot of changes made to the repository. It is a way to save and track the progress of your work.
Answer:
To create a new branch, you can use the "git branch" command followed by the branch name, or use "git checkout -b" to create and switch to the new branch.
Answer:
To merge branches, you can use the "git merge" command followed by the branch you want to merge into your current branch.
Answer:
A pull request is a way to propose changes from one branch to another in a GitHub repository. It allows for code review and collaboration before merging the changes.
Answer:
To resolve a merge conflict, you need to manually edit the conflicting files, remove conflict markers, and then commit the resolved changes.
Answer:
The ".gitignore" file is used to specify files and directories that should be ignored by Git, preventing them from being tracked or committed.
Answer:
You can revert a commit using the "git revert" command followed by the commit hash or reference. It creates a new commit that undoes the changes made in the previous commit.
Answer:
"git pull" fetches changes from a remote repository and merges them into the current branch, while "git fetch" only retrieves the changes without merging.
Answer:
You can undo the last commit using the "git reset" command with the "--soft" or "--mixed" option, followed by the commit reference or HEAD~1.
Answer:
A Git remote is a reference to a remote repository. It allows you to fetch and push changes to and from the remote repository.
Answer:
Git stash is used to temporarily save changes that are not ready to be committed, allowing you to switch to a different branch without committing incomplete work.
Answer:
You can view the commit history using the "git log" command, which displays a list of commits, their messages, and other relevant details.
Answer:
"git fetch" retrieves the latest changes from a remote repository without merging, while "git pull" retrieves the changes and merges them into the current branch.
Answer:
You can revert a file to a specific commit using the "git checkout" command followed by the commit hash or reference and the file path.
Answer:
You can create a tag in Git using the "git tag" command followed by the tag name and the commit hash or reference you want to tag.
Answer:
Rebasing is used to incorporate changes from one branch into another, maintaining a linear commit history and avoiding unnecessary merge commits.
Answer:
You can delete a branch using the "git branch -d" command followed by the branch name. The branch must be merged into another branch before deletion.
Answer:
You can squash multiple commits into a single commit using the "git rebase -i" command and specifying the commits you want to squash.
Answer:
Git hooks are scripts that are executed automatically at specific points in the Git workflow, allowing you to customize and automate certain actions.
Answer:
You can contribute to an open-source project on GitHub by forking the repository, making changes in your forked repository, and creating a pull request to propose your changes to the original project.