Unit 2 - Getting Started With GIT
Unit 2 - Getting Started With GIT
Configure Your Identity: Open Git Bash (or your terminal) and run the following commands,
replacing the placeholders with your actual information:
arduinoCopy code
These commands set your name and email as the default identity for your Git commits.
luaCopy code
Verify Your Configuration: You can view your entire Git configuration by running:
cssCopy code
GIT Tools
There are several tools and software applications that complement and enhance the experience
of using Git for version control and collaborative software development. Here are some
commonly used Git tools:
Git GUI Clients: These are graphical user interface applications that provide a visual way to
interact with Git repositories. They can be especially helpful for those who prefer a more visual
approach to managing version control.
GitKraken
Unit -2 Getting started with GIT
SourceTree
GitHub Desktop
Diff and Merge Tools: These tools help you visualize and manage differences between versions
of files, making it easier to understand changes and resolve conflicts.
KDiff3
Beyond Compare
P4Merge
Code Review Platforms: While not Git tools in the traditional sense, code review platforms
integrate with Git repositories to facilitate collaboration and peer code reviews.
Gerrit
Git LFS (Large File Storage): Git LFS is an extension that manages large files in Git repositories,
storing them externally and replacing them with pointers in the repository to save space and
improve performance.
GIT Terminologies
1. Repository (Repo): A directory or storage space where your projects can live. It contains
all the files, history, and configuration related to your project.
2. Commit: A snapshot of your project's state at a particular point in time. Each commit
represents a set of changes made to files.
3. Branch: A separate line of development. You can think of it as a parallel version of the
repository. Branches are often used for developing new features or isolating bug fixes.
4. Master/Main Branch: The default branch in a Git repository. It typically represents the
main line of development and is considered stable.
5. Clone: Creating a copy of a repository from a remote source onto your local machine.
6. Remote: A version of your repository stored on a server, often hosted by a platform like
GitHub, GitLab, or Bitbucket.
Unit -2 Getting started with GIT
7. Pull: Fetching changes from a remote repository and merging them into your local
branch.
8. Push: Sending your committed changes to a remote repository. This updates the remote
repository with your changes.
9. Merge: Combining the changes from one branch into another. For example, merging a
feature branch into the main branch.
10. Pull Request (PR): A request to merge changes from one branch into another. It's a
common workflow for collaboration and code review.
11. Fork: Creating a personal copy of someone else's repository. This allows you to make
changes without affecting the original repository.
12. Conflict: A situation that occurs when Git cannot automatically merge changes due to
conflicting edits in the same part of a file. Conflicts must be resolved manually.
13. Merge Conflict: An occurrence of conflicting changes that need to be resolved before a
merge can be completed.
14. Tag: A reference to a specific commit, often used to mark a version or release point.
15. Pull Request Review: The process of reviewing and discussing changes proposed in a
pull request before merging.
16. Gitignore: A file that specifies which files and directories should be ignored by Git,
usually because they are not relevant to the project or contain sensitive information.
17. Staging Area (Index): A temporary area where you can stage changes before committing
them. It allows you to control which changes are included in the next commit.
18. HEAD: A reference to the latest commit in the currently checked-out branch. It
represents your current working state.
19. SHA-1 Hash: A unique identifier for a commit or an object in the Git repository. It's a
long alphanumeric string.
GIT Commands
1. Creating and Cloning Repositories:
git clone <repository_url>: Clone a remote repository onto your local machine.
git remote add origin < repository_url >: Add local directory to the remote
repository
2. Committing Changes:
3. Branches:
git merge <branch_name>: Merge changes from one branch into the current
branch.
git rebase <branch_name>: Rebase the current branch onto another branch.
4. Remote Repositories:
git remote -v: List remote repositories associated with your local repository.
git fetch: Retrieve changes from a remote repository without merging them.
git pull-request: Create a pull request (this command varies based on the
platform you're using, like GitHub or GitLab).
git checkout -b <new_branch>: Create a new branch and switch to it in one step.
git diff: Show changes between working directory and the last commit.
7. Undoing Changes:
git checkout -- <file>: Discard changes in the working directory for a file and
revert to the last commit's version.
git revert <commit>: Create a new commit that undoes changes made in a
previous commit.
8. Tags:
you can use git --help or git <command> --help to access the built-in Git documentation for any
specific command.