Why Do So Many Alcoholics Fear a Holiday Relapse?

The holiday season should be fun and relaxing, but for many alcoholics, it’s the most stressful time of year. Even when our recovery is going well, somehow we can’t help seeing each upcoming holiday…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Quickstart on Git Commands

An entry-level guide for beginners

When you start working on a project you might have heard that the codebase is in Github/Gitlab/Bitbucket. Ever wondered what are these?.

Well, Github/Gitlab/Bitbucket these are all repository hosting services, which is built on top of Git.

Nowadays Git is the de facto tool for a project development, where the repository holds all your versions of the content inside a repo. On each commits a child version from the parent is created with the new changes, and all the info about the versions are stored in the index.

When you start working on a repository, you are basically working on a copy of your source repository, and each repository has its own index, so whatever changes you are doing is tracked in the index and once it is pushed it gets updated in the source.

Let’s say you have joined this new company and this project totally maintained in the Git. The first thing you need to do is to get the codebase and then only you can analyze and show your skills in it.

Note:

git init

The command git init helps you to create a fresh repository in your local. Not all the time you’ll work on an existing project, let’s say you got this amazing idea and you start working on this idea by building it from scratch.

Note: The command git init doesn’t configure to your remote URL unlike the command git clone, you need to manually configure it.

git config [options]

While we installing the Git, the Git won’t configure your username and mail in it, you need to configure it manually to your id as it is in your remote repository. Else all the commits will be pushed in the name of your system’s name. You can configure it with the following command

git config [level] user.name "Your name"

git config [level] user.email "your@mail.id"

There are three levels of configurations in the Git

Each Level has its scope where the --system configurations for all the users/projects, --global is for all the projects of the current user and finally the --local configurations are only for the project where it is defined

You can always view these configurations by the command

git config [level] --list e.g. git config --local --list

git remote [options]

With git remote command one can view the details of the remote repository where it is configured.

git remote -v helps you view the URL of the remote repository

git remote add <name> <url> helps you to configure the remote manually when you created a fresh repo and you want to configure it to the remote repo

In a project for a release, the team won't be working for a single issue/feature, there will be multiple issues/features that need to be fixed and the team can’t wait till another finishes theirs unless it is impacting theirs, this where the branch comes.

Consider the whole structure as a tree, the Master is the stem of the tree and the stem can have n no. of branches which is a copy of its parent and as the same the branch also can have n no. of sub-branches. Each branch will have its changes and these changes can be merged with its parent and it is called Merging

git branch [options]

With this command, we can view the current and all branches in the repository.

git branch shows the current branch in which the local repository is pointed to.

git branch --list lists all the branches in your local and the --all lists all the branches in the repository

git checkout <branch>

With this command, we can switch between and create branches in a repository

git checkout <branch> checks out all the changes that are associated in branch

git checkout -b <branch> creates a new branch in the local and once it's pushed the branch and its changes will be reflected in the remote repository.

git add [file.extension|wildcard]

With these commands, one can add or remove files from the repository.

In Git, every change are recorded as a snapshot of the file so whether you are creating a file or updating the file you’ll need the commandgit add to reflect the changes.

Wildcards:

Note: With git rm [file.extension|wildcard] we can delete the files in the repo’s file structure.

git commit

With git commit we can commit our changes to the index.

git commit -m "your commit message" commits your changes with a comment about it.

git status

With git status we can see all the new, modified, deleted untracked files in your local repository.

git log

With the commandgit log , we can see the commit history in the current branch.

git diff [options]

With the command, git diff we can see the difference between the commits, current working tree, etc.

git diff shows all the changed files with the changes between the current index

git diff file.extension shows the changes in the file.extension between the current index

git push <name> <branch>

With the command, git push we can update the commits to the remote repository from your local repository. By default, the branch is set to master unless you specified

git pull <name> <branch>

With the command, git push we can update the commits to your local repository from the remote repository. By default, the branch is set to master unless you specified.

git reset [options]

With the git reset we can reset our changes back to the current commit or to a diff commit. We can change a single file or the whole repository with this command.

It’s only an opening shot and a handful of info I have shared with you guys. There is a lot more for us to see in Git and every developer needs to know about it. I hope you enjoyed this article and this might kickoff someone’s interest in exploring Git.

Happy Coding...

Add a comment

Related posts:

Study for a major test without burning out

Deciding to pursue any kind of certification that requires passing a major test is a big undertaking. It requires commitment — of time, resources, and attention. And this is why many of us dread the…

6 Reasons Your Local Business Listings Need to Be Accurate

The whole point of an online presence is to entice customers into your store, your leasing office or your showroom so you can convert them to paying customers rather than just browsers online…

Fresh publications about SocialMedia.Market

SocialMedia.market is an international project which unites brands and bloggers all over the globe. We are proud that our idea has found a response in different parts of the world and…