Ans: Git is a distributed version control system that allows multiple developers to work on a project simultaneously, keeping track of changes in code.
Ans: GitHub is a web-based hosting service that uses Git for version control. It provides a platform for collaboration, code sharing, and project management.
Ans: Git is the version control system itself, while GitHub is a web-based platform built around Git that provides additional collaboration features.
Ans: Git offers features such as decentralized development, easy branching and merging, version control, and offline capabilities.
Ans: You can create a Git repository by using the "git init" command in the desired project directory.
Ans: A commit represents a snapshot of changes made to the repository. It is a way to save and track the progress of your work.
Ans: 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.
Ans: To merge branches, you can use the "git merge" command followed by the branch you want to merge into your current branch.
Ans: 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.
Ans: To resolve a merge conflict, you need to manually edit the conflicting files, remove conflict markers, and then commit the resolved changes.
Ans: The ".gitignore" file is used to specify files and directories that should be ignored by Git, preventing them from being tracked or committed.
Ans: 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.
Ans: "git pull" fetches changes from a remote repository and merges them into the current branch, while "git fetch" only retrieves the changes without merging.
Ans: 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.
Ans: A Git remote is a reference to a remote repository. It allows you to fetch and push changes to and from the remote repository.
Ans: 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.
Ans: You can view the commit history using the "git log" command, which displays a list of commits, their messages, and other relevant details.
Ans: "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.
Ans: 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.
Ans: 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.
Ans: Rebasing is used to incorporate changes from one branch into another, maintaining a linear commit history and avoiding unnecessary merge commits.
Ans: 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.
Ans: You can squash multiple commits into a single commit using the "git rebase -i" command and specifying the commits you want to squash.
Ans: Git hooks are scripts that are executed automatically at specific points in the Git workflow, allowing you to customize and automate certain actions.
Ans: 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.