Self-Reflection: Git & GitHub Workshop

- Git is the most commonly used version control system.

- Git tracks the changes we make to files, so we have a record of what has been done, and we can also revert to specific versions whenever we need.

- Git also makes collaboration easier, allowing changes by multiple people to be merged into one source.

- It provides the facility of Source Code Management (SCM).

- The working area is where the files that are not tracked by bit are present ( these files are called untracked files ).

- The files present in the staging area are those which are a part of the next commit. Git tracks all the changes made in these files.

- Staging Area doesn’t store the files rather it stores the indices of the codes we update.

- git commit creates a commit, which is like a snapshot of our repository. These commits are snapshots of our entire repository at specific times. ( Also called as Backup area ).

- Point-In-Time backup is the backup where just the new part is updated. The tracker tracks every time.

- Gitbash is the terminal tool for windows that is used to communicate with the git VCS tool.

- All the above features can be achieved by creating a git repository.

- To create a git repository, we have to use the “git init” command. This command creates a “.git” file in the given directory.

- “ls -a” command can be used to see this file ( it is a hidden file ).

- To add files to the staging area use the “ git add file_name “ command.

- To add all the files to the staging area use the “git add . “ command.

- Every commit creates a version of the files in the staging area. Hence a reference is assigned to every commit to uniquely identify them.

- We check the commits using the “git log” or “git reflog” command.

- git log shows the current HEAD and its ancestry. That is, it prints the commit HEAD points to, then its parent, its parent, and so on.

- It traverses back through the repo’s ancestry, by recursively looking up each commit’s parent.

- “git log — oneline” command gives concise information about all the commits.

- “git status” command displays the state of the working directory and the staging area.

- It lets us see which changes have been staged, which haven’t, and which files aren’t being tracked by Git.

- “git commit file_name -m “msg” “ command is used to commit the changes.

- The developers can work in their own branches and later can make a pull request ( request to merge ) to the master.

- The developer’s branch is said to be the upstream branch as it is ahead of the master branch.

- “git branch branch_name” command can be used to create a new branch.

- “git checkout branch_name” command can be used to switch to the given branch.

- “git branch — set-upstream-to=branch_name” command is used to set up the “master” branch to track a local branch.

- Now “master” branch will monitor the given branch and the “git status” command will give the current status of the master ( whether it is ahead or behind the given branch ).

- When we set a branch as the upstream branch, we can use the “git pull branch_name” command to pull the data from the upstream branch to the master.

- This command by default uses the fast forward strategy.

- GitHub is a code hosting platform for version control and collaboration.

- “git remote add –name “Repository link” command can be used to locate the remote folder.

- “git show versionID” command shows all the data that has been modified ( changes ) at the given commit.

- “git diff versionID1 versionID2” command can be used to compare two versions.

- The “git config” command allows us to set configuration values in the filesystem. Executing this Git command modifies the main configuration text file

- “git remote” command allows us to create, view, and delete our connection to repositories.

- “git fetch” is the command that tells the local git to retrieve the latest meta-data info from the original.

- “git pull” command is used to bring a local git branch up-to-date with its remote version.

- Git hooks are scripts that Git executes locally before or after events such as commit, push, and receive.

- Every Git repository has a .git/hooks folder with a script for each hook we can bind to.

- Webhooks allow other services to be notified when certain events happen by sending a POST request to each of the URLs we provide.

- “git cat-file -p versionID” returns the metadata of the given commit. MetaData includes ( Tree, Parent, author, committer ).

- GitKraken is a git tool that is used to track the changes in GUI mode. This tool has different functionality like clone,

push, adding remote repositories, visualize the commits, etc.

- fork is a copy of a repository that sits in our account rather than the account from which we forked the data from.

- This means that we can edit the contents of the forked repository without impacting the parent repo.

- After making the changes we can open a pull request to the original repo.

- Contributors can be assigned to the pull requests for verification.

- Squash method is preferred when we don’t want to see all of a contributor’s individual commits. All the commits are combined into one commit and merged into the default branch.

- Rebasing is the process of moving or combining a sequence of commits to a new base commit.

- It compresses all the changes into a single “patch” and then integrates it onto the target branch.

- This is majorly used when a branch wants to get all the new changes in the master branch.

- “git rebase master” command can be used.

- Cherry-picking in Git means to choose a commit from one branch and apply it to another.

- It doesn’t merge them rather it copies the changes and creates a new commit.

- “git cherry-pick versionID” command can be used.

- “git stash” temporarily stores the changes made to the working copy so that we can work on something else, and then come back and re-apply them later on

- “git stash list”, “git stash save”, “git stash apply” commands can be used.

- “git reset” command is used to revert to other commits.

- Three types of reset are mixed, soft, and hard.

- p4vinst64 is used to resolve merge conflicts.

- Git also provides a feature of Distributed Version Control System ( peer-to-peer version control system ).

#Self_reflection #worldrecordholder #righteducation #rightmentor #makingindiafutureready #gitbylw #gitandgithub #We_are_ARTH_Learners

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
MAYANK VARSHNEY

MAYANK VARSHNEY

3 Followers

I am a forward-thinking individual with exceptional skills in problem-solving, adaptive thinking, automation, and development.