Clone Operation

1st will copy the repository path, then will clone to desired location.

git clone

That creates a directory named Data-analytics-(at your current local file system location), initializes a .git directory inside it, pulls down all the data for that repository, and checks out a working copy of the latest version. If you go into the newly created Data-analytics-directory, you’ll see the project files in there, ready to be worked on or used.

Perform some changes:

In the existing file made some changes and check the git status.

after changes

Add to staging

add to st1

committing to repository

commit to git

Check the logs

logs.png

Git show command will show commit related logs (git show <commit_id>)

git show

The main objective of version controlling is to enable you to work with different versions of files. Git provides a command diff to let you to compare different versions of your files.

Let’s make a change in the start.txt file now and compare this file with previously committed version.

changes

shows the exact change I made in the file. But, if you look at the diff command, you might wonder what HEAD is doing there! Well, it is there for a purpose.

If you can recall, Git has an index between local repository and your working directory. So most of Git commands can either refer to index or the local repo. When you say HEAD in your Git command, it refers the local repo.

you can check the difference between two commit, considering commit ID

commitid git

Stash in Git

Suppose you are implementing a new feature for your product. Your code is in progress and suddenly a customer escalation comes. Because of this, you have to keep aside your new feature work for a few hours. You cannot commit your partial code and also cannot throw away your changes. So you need some temporary space, where you can store your partial changes and later on commit it.

In Git, the stash operation takes your modified tracked files, stages changes, and saves them on a stack of unfinished changes that you can reapply at any time.

git stash

Suppose you have resolved the customer escalation and you are back on your new feature looking for your half-done code, just execute the git stash pop command, to remove the changes from the stack and place them in the current working directory.

git stash1

 

 

 

Advertisements