Search Your Question...!

Showing posts with label GIT. Show all posts
Showing posts with label GIT. Show all posts

Git: Stashing changes - Basic (Java)

 Welcome to Git: Stashing changes - Basic (Java).

This question is used to evaluate your skills on stashing the changes in Git.

For this, you will be evaluated based on the following operations. The remote repository has been pre-configured into your local git repository.

  1. Your local git repository will be linkedlist_java.
  2. Push the master branch of local git repository to the remote repository.
  3. Create a new branch with the name new_branch.
  4. Make a change to the Java program file (do not remove it), make a commit and push the branch.
  5. Make a few more changes to the Java program file and stash those changes.

GIT INTERVIEW QUESTIONS - 1

 1) What is GIT?

GIT is a distributed version control system and source code management (SCM) system with an emphasis to handle small and large projects with speed and efficiency.

  2) What is the command you can use to write a commit message?

The command that is used to write a commit message is “git commit –a”. The –a on the command line instructs git to commit the new content of all tracked files that have been modified. You can use “git add<file>” before git commit –a if new files need to be committed for the first time.

 3) What is the difference between GIT and SVN?

 The difference between GIT and SVN is

 a)  Git is less preferred for handling extremely large files or frequently changing binary files while SVN can handle multiple projects stored in the same repository.

 b) GIT does not support ‘commits’ across multiple branches or tags. Subversion allows the creation of folders at any location in the repository layout.

 c) Gits are unchangeable, while Subversion allows committers to treat a tag as a branch and to create multiple revisions under a tag root.

 

More on Git MCQ's

1. What is the git command to see the last 3 commits in one line ?

   View Answer   

   git log -–oneline -3 



2. How do I view all the commits for the last 2 weeks ?

   View Answer   

   git log -–since=”2 weeks ago” 



3. What is the significance of using –index in the git stash pop - - index command ?

   View Answer   

   To pull the staged changes  



4. What is the command to temporarily store uncommitted ?

   View Answer   

   git stash 



5. What command should I use to retrieve my files that have been temporarily stashed ?

   View Answer   

   git stash pop – index