t1k p7 (build)

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What is a repository in GIT?

A repository in GIT is the place in which we store our software work. It contains a sub-directory called .git. There is only one .git directory in the root of the project. In .git, GIT stores all the metadata for the repository. The contents of .git directory are of internal use to GIT.

What is a Repository in Maven?

A repository is a location on file system where build artifacts, jars, dependencies and pom.xml files are stored.

What is shortlog in GIT?

A shortlog in GIT is a command that summarizes the git log output. The output of git shortlog is in a format suitable for release announcements.

What is the alternative command to merging in GIT?

Another alternative of merging in GIT is rebasing. It is done by git rebase command.

What are the main required elements in POM file?

Every POM file should have following required elements: project root modelVersion groupID: the id of the project's group. artifactID: the id of the artifact (project) version: the version of the artifact under the specified group

How can you find the names of files that were changed in a specific commit?

Every commit in GIT has a hash code. This hash code uniquely represents the GIT commit object. We can use git diff-tree command to list the name of files that were changed in a commit. The command will be as follows: git diff-tree -r <hash of commit> By using -r flag, we just get the list of individual files.

What are the four major protocols used by GIT for data transfer?

GIT uses following major protocols for data transfer: Local HTTP Secure Shell (SSH) Git

What are the programming languages in which git hooks can be written?

Git hooks are generally written in shell and PERL scripts. But these can be written in any other language as long as it has an executable. Git hooks can also be written in Python script.

What are git hooks?

Git hooks are scripts that can run automatically on the occurrence of an event in a Git repository. These are used for automation of workflow in GIT. Git hooks also help in customizing the internal behavior of GIT. These are generally used for enforcing a GIT commit policy.

What are the differences between Gradle and Maven?

Gradle is nowadays getting more popular. Google uses it for Android development and release. Companies like LinkedIn also use Gradle. Gradle is based on Domain Specific Language (DSL). Maven is based on XML. Gradle gives more flexibility to do custom tasks similar to ANT. Maven scripts have predefined structure. So it is less flexible. Maven is mainly used for Java based systems. Gradle is used for a variety of languages. It is a Polyglot build tool.

What is filter-branch in GIT?

In GIT, filter-branch is another option to rewrite history. It can scrub the entire history. When we have large number of commits, we can use this tool. It gives many options like removing the commit related changes to a specific file from history. You can even set you name and email in the commit history by using filter-branch.

What is the use of git diff command in GIT?

In GIT, git diff command is used to display the differences between 2 versions, or between working directory and an index, or between index and most recent commit. It can also display changes between two blob objects, or between two files on disk in GIT. It helps in finding the changes that can be used for code review for a feature or bug fix.

How will you switch from one branch to a new branch in GIT?

In GIT, we can use git checkout <new branchname> command to switch to a new branch.

What is git clone in GIT?

In GIT, we use git clone command to create a copy of an existing GIT repository in our local. This is the most popular way to create a copy of the repository among developers. It is similar to svn checkout. But in this case the working copy is a full-fledged repository.

What is the command in Maven to generate an Archetype?

In Maven, we can use following command to generate an Archetype: mvn archetype:generate

What are the different setting files in Maven?Where will you find these files?

Maven is very simple to use. At the core it has a setting file names settings.xml. This file contains the setting element that is used to configure the Maven with different options. The main locations where this file can be found are: Maven Installation directory: ${maven.home}/conf/settings.xml User Home directory: ${user.home}/ .m2 / settings.xml

GIT is written in which language?

Most of the GIT distributions are written in C language with Bourne shell. Some of the commands are written in Perl language.

Is origin a special branch in GIT?

No, origin is not a special branch in GIT. Branch origin is similar to branch master. It does not have any special meaning in GIT. Master is the default name for a starting branch when we run git init command. Origin is the default name for a remote when we run git clone command. If we run git clone -o myOrigin instead, then we will have myOrigin/master as our default remote branch.

Can anyone upload JARS or artifacts to Central Repository?

No, we need special permissions to upload JARS and artifacts to Central Maven Repository?

What is SubGit?

SubGit is software tool used for migrating SVN to Git. It is very easy to use. By using this we can create a writable Git mirror of a Subversion repository. It creates a bi-directional mirror that can be used for pushing to Git as well as committing to Subversion. SubGit also takes care of synchronization between Git and Subversion.

What is Super POM?

Super POM is Maven's default POM. All the POM files extend from Super POM.

What is the most popular use of Docker?

The most popular use of Docker is in build pipeline. With the use of Docker it is much easier to automate the development to deployment process in build pipeline. We use Docker for the complete build flow from development work, test run and deployment to production environment.

What GUI do you use for working on GIT?

There are many GUI for GIT that we can use. Some of these are: GitHub Desktop GITX-dev Gitbox Git-cola SourceTree Git Extensions SmartGit GitUp

How will you verify if Maven is installed on Windows?

To check this, type mvn -version in cmd prompt of Windows. This will give you the version of Maven installed on Windows.

What command will you use to delete a branch that has unmerged changes?

To forcibly delete an unwanted branch with unmerged changes, we use following command: git branch -D <branchname>

What is the purpose of git config command?

We can set the configuration options for GIT installation by using git config command.

What are the responsibilities of a Build tool like Maven?

A Build tool like Maven helps us with following tasks: Source Code: A Build tool can generate source code based on templates. Documentation: We can get documentation files from source code by using a build tool. E.g. Javadoc Compilation: Primary responsibility of a Build tool is to compile source code into executable code. Packaging: A Build tool packages compiled code into a deployable file like- jar, zip war etc. Deployment: We can deploy the packaged code on server by using a Build tool.

What is the HEAD in GIT?

A HEAD is a reference to the currently checked out commit. It is a symbolic reference to the branch that we have checked out. At any given time, one head is selected as the 'current head' This head is also known as HEAD (always in uppercase).

Do we have to store Scripts for GIT hooks within same repository?

A Hook is local to a GIT repository. But the script attached to a hook can be created either inside the hooks directory or it can be stored in a separate repository. But we have to link the script to a hook in our local repository. In this way we can maintain versions of a script in a separate repository, but use them in our repository where hooks are stored. Also when we store scripts in a separate common repository, we can reuse same scripts for different purposes in multiple repositories.

What is a Maven artifact?

A Maven artifact is a file that gets deployed to a Maven repository. In most cases it is a JAR file. When Maven build runs, it creates one or more artifacts. In case of Java projects, it produces a compiled jar and a sources jar. Every artifact in Maven has a group ID, an artifact ID and a version string. These three attributes uniquely identify an artifact. In Maven, we specify a project's dependencies as artifacts.

What is the format of fully qualified artifact name of a Maven project?

A Maven project has artifact name with following format: <groupId>:<artifactId>:<version> Following is the convention used by some organizations: Parent pom groupId: org.Orgname.Projectname artifactId: org.Orgname.Projectname version: x.x.x E.g. org.Orgname.Projectname:org.Orgname.Projectname-1.0.0.pom Modules groupId: org.Orgname.Projectname artifactId: org.Orgname.Projectname.Modulename version: x.x.x E.g. org.Orgname.Projectname:org.Orgname.Projectname.Modulename- 1.0.0.jar

What is a Remote repository in Maven?

A Remote repository is a remote location on the internet where the jars and dependencies from different vendors are stored. These files can be accessed by protocols like- file:// or http:// etc. These can be truly remote repositories set up by third party vendors or locations inside your organization that contains the relevant jars required by your project.

What is the difference between a Release version and SNAPSHOT version in Maven?

A SNAPSHOT version in Maven is the one that has not been released. Before every release version there is a SNAPSHOT version. Before 1.0 release there will be 1.0-SNAPSHOT. If we download 1.0-SNAPSHOT today then we may get different set of files than the one we get on downloading it yesterday. SNAPSHOT version can keep getting changes in it since it is under development. But release version always gives exactly same set files with each download.

What is a Shell variable?

A Unix Shell variable is an internal variable that a shell maintains. It is local to that Shell. It is not made available to the parent shell or child shell. We generally use lower case names for shell variables in C shell. We can set the value of a shell variable by set command. E.g. % set max_threads=10 To delete a Shell variable we can use unset command. To use a Shell variable in a script we use $ sign in front of the variable name. E.g. echo $max_threads

What is a commit message in GIT?

A commit message is a comment that we add to a commit. We can provide meaningful information about the reason for commit by using a commit message. In most of the organizations, it is mandatory to put a commit message along with each commit. Often, commit messages contain JIRA ticket, bug id, defect id etc. for a project.

What is cherry-pick in GIT?

A git cherry-pick is a very useful feature in GIT. By using this command we can selectively apply the changes done by existing commits. In case we want to selectively release a feature, we can remove the unwanted files and apply only selected commits.

What is merge conflict in GIT?

A merge conflict in GIT is the result of merging two commits. Sometimes the commit to be merged and current commit have changes in same location. In this scenario, GIT is not able to decide which change is more important. Due to this GIT reports a merge conflict. It means merge is not successful. We may have to manually check and resolve the merge conflict.

What is a pull request in GIT?

A pull request in GIT is the list of changes that have been pushed to GIT repository. Generally these changes are pushed in a feature branch or hotfix branch. After pushing these changes we create a pull request that contains the changes between master and our feature branch. This pull request is sent to reviewers for reviewing the code and then merging it into develop or release branch.

What is a bare repository in GIT?

A repository created with git init -bare command is a bare repository in GIT. The bare repository does not contain any working or checked out copy of source files. A bare repository stores git revision history in the root folder of repository instead of in a .git subfolder. It is mainly used for sharing and collaborating with other developers. We can create a bare repository in which all developers can push their code. There is no working tree in bare repository, since no one directly edits files in a bare repository.

What is the difference between absolute path and relative path in Unix file system?

Absolute path is the complete path of a file or directory from the root directory. In general root directory is represented by / symbol. If we are in a directory and want to know the absolute path, we can use pwd command. Relative path is the path relative the current location in directory. E.g. In a directory structure /var/user/kevin/mail if we are in kevin directory then pwd command will give absolute path as /var/user/kevin. Absolute path of mail folder is /var/user/kevin/mail. For mail folder ./mail is the relative path of mail directory from kevin folder.

What command will you use to delete a branch?

After the successful merge of feature branch in main branch, we do not need the feature branch. To delete an unwanted branch we use following command: git branch -d <branchname>

What is an Inode in Unix?

An Inode is a Data Structure in Unix that denotes a file or a directory on file system. It contains information about file like- location of file on the disk, access mode, ownership, file type etc. Each Inode has a number that is used in the index table. Unix kernel uses Inode number to access the contents of an Inode. We can use ls -i command to get the inode number of a file.

What is an Archetype in Maven?

As per official definition, an Archetype is a Maven project templating toolkit. By using an Archetype, an author of Archetype can create a Project template. Users of this project template (archetype) can pass different parameters to this template and start using it. Archetype promotes consistency in the process of creating and working on a project. It also helps in reducing the ramp up time for new developers to come on board on a project.

How can we get the debug or error messages from the execution of Maven?

At times, project build or compile fails in Maven. At this time it is very helpful to see the debug or error messages from Maven execution. To get the debug messages we can call Maven with -X option. To get the error/exception messages we can call Maven with -e option.

Why do we use Interactive Rebasing in place of Auto Rebasing?

By using Interactive rebasing we can alter the commits before moving them to a new branch. This is more powerful than an automated rebase. It gives us complete control over the branch's commit history. Generally, we use Interactive Rebasing to clean up the messy history of commits just before merging a feature branch into master.

What is Command Substitution in Unix?

Command substitution is a mechanism by which Shell passes the output of a command as an argument to another command. We can even use it to set a variable or use an argument list in a for loop. E.g. rm `cat files_to_delete` In this example files_to_delete is a file containing the list of files to be deleted. cat command outputs this file and gives the output to rm command. rm command deletes the files. In general Command Substitution is represented by back quotes `.

Why do we say "Maven uses convention over configuration"?

Convention over configuration is a Software Design Paradigm that decreases the number of decisions made by a software developer, without losing flexibility. In Maven, there are many conventions for setting up the project, building the artifacts, running unit tests and releasing the code. These conventions lead to common process for Software development. In case of other tools, there are a lot of configuration options are present. But most of the time, a developer uses same set of configuration options. So it is better to make these as a default options. Maven uses default options from best practices and provides right conventions for Software development.

What is the difference between Docker image and Docker container?

Docker container is simply an instance of Docker image. A Docker image is an immutable file, which is a snapshot of container. We create an image with build command. When we use run command, an Image will produce a container. In programming language, an Image is a Class and a Container is an instance of the class.

What is Docker?

Docker is Open Source software. It provides the automation of Linux application deployment in a software container. We can do operating system level virtualization on Linux with Docker. Docker can package software in a complete file system that contains software code, runtime environment, system tools, & libraries that are required to install and run the software on a server.

What are the different ways to identify a commit in GIT?

Each commit object in GIT has a unique hash. This hash is a 40 characters checksum hash. It is based on SHA1 hashing algorithm. We can use a hash to uniquely identify a GIT commit. Git also provides support for creating an alias for a commit. This alias is known as refs. Every tag in GIT is a ref. These refs can also be used to identify a commit. Some of the special tags in GIT are HEAD, FETCH_HEAD and MERGE_HEAD.

What is stored inside a commit object in GIT?

GIT commit object contains following information: SHA1 name: A 40 character string to identify a commit Files: List of files that represent the state of a project at a specific point of time Reference: Any reference to parent commit objects

Why do we need git add command in GIT?

GIT gives us a very good feature of staging our changes before commit. To stage the changes we use git add command. This adds our changes from working directory to the index. When we are working on multiple tasks and we want to just commit the finished tasks, we first add finished changes to staging area and then commit it. At this time git add command is very helpful.

What are the three main steps of working GIT?

GIT has following three main steps in a simple workflow: Checkout the project from HEAD to Working Directory. Stage the files from Working Directory to Index. Commit the changes from Index to HEAD.

What are the disadvantages of GIT?

GIT has very few disadvantages. These are the scenarios when GIT is difficult to use. Some of these are: Binary Files: If we have a lot binary files (non-text) in our project, then GIT becomes very slow. E.g. Projects with a lot of images or Word documents. Steep Learning Curve: It takes some time for a newcomer to learn GIT. Some of the GIT commands are non-intuitive to a fresher. Slow remote speed: Sometimes the use of remote repositories in slow due to network latency. Still GIT is better than other VCS in speed.

What is GIT?

GIT is a mature Distributed Version Control System (DVCS). It is used for Source Code Management (SCM). It is open source software. It was developed by Linus Torvalds, the creator of Linux operating system. GIT works well with a large number of IDEs (Integrated Development Environments) like- Eclipse, InteliJ etc. GIT can be used to handle small and large projects.

How GIT protects the code in a repository?

GIT is made very secure since it contains the source code of an organization. All the objects in a GIT repository are encrypted with a hashing algorithm called SHA1. This algorithm is quite strong and fast. It protects source code and other contents of repository against the possible malicious attacks. This algorithm also maintains the integrity of GIT repository by protecting the change history against accidental changes.

What is git grep?

GIT is shipped along with a grep command that allows us to search for a string or regular expression in any committed tree or the working directory. By default, it works on the files in your current working directory.

How GIT provides flexibility in version control?

GIT is very flexible version control system. It supports non-linear development workflows. It supports flows that are compatible with external protocols and existing systems. GIT also supports both branching and tagging that promotes multiple kinds of workflows in version control.

What are the three main trees maintained by GIT?

GIT maintains following three trees: HEAD: This is the last commit snapshot. Index: This is the proposed next commit snapshot. Working Directory: This is the sandbox for doing changes.

How can we ignore merge conflicts due to Whitespace?

GIT provides an option ignore-space-change in git merge command to ignore the conflicts related to whitespaces. The command to do so is as follows: git merge -Xignore-space-change whitespace

How can we clean unwanted files from our working directory in GIT?

GIT provides git clean command to recursively clean the working tree. It removes the files that are not under version control in GIT. If we use git clean -x, then ignored files are also removed.

When we run git branch <branchname>, how does GIT know the SHA-1 of the last commit?

GIT uses the reference named HEAD for this purpose. The HEAD file in GIT is a symbolic reference to the current branch we are working on. A symbolic reference is not a normal reference that contains a SHA- 1 value. A symbolic reference contains a pointer to another reference. When we open head file we see: $ cat .git/HEAD ref: refs/heads/master If we run git checkout branchA, Git updates the file to look like this: $ cat .git/HEAD ref: refs/heads/branchA

What is GIT version control?

GIT version control helps us in managing the changes to source code over time by a software team. It keeps track of all the changes in a special kind of database. If we make a mistake, we can go back in time and see previous changes to fix the mistake. GIT version control helps the team in collaborating on developing a software and work efficiently. Every one can merge the changes with confidence that everything is tracked and remains intact in GIT version control. Any bug introduced by a change can be discovered and reverted back by going back to a working version.

Why is it advisable to create an additional commit instead of amending an existing commit?

Git amend internally creates a new commit and replaces the old commit. If commits have already been pushed to central repository, it should not be used to modify the previous commits. It should be generally used for only amending the git comment.

What is the command for Rebasing in Git?

Git command for rebasing is: git rebase <new-commit>

What is GIT protocol?

Git protocol is a mechanism for transferring data in GIT. It is a special daemon. It comes pre-packaged with GIT. It listens on a dedicated port 9418. It provides services similar to SSH protocol. But Git protocol does not support any authentication. So on plus side, this is a very fast network transfer protocol. But it lacks authentication.

What is the use of git instaweb?

Git-instaweb is a script by which we can browse a git repository in a web browser. It sets up the gitweb and a web-server that makes the working repository available online.

How can we change a commit message in GIT?

If a commit has not been pushed to GitHub, we can use git commit -- ammend command to change the commit message. When we push the commit, a new message appears on GitHub.

Why do we create branches in GIT?

If we are simultaneously working on multiple tasks, projects, defects or features, we need multiple branches. In GIT we can create a separate branch for each separate purpose. Let say we are working on a feature, we create a feature branch for that. In between we get a defect to work on then we create another branch for defect and work on it. Once the defect work is done, we merge that branch and come back to work on feature branch again. So working on multiple tasks is the main reason for using multiple branches.

How can we attach an automated script to run on the event of a new commit by push command?

In GIT we can use a hook to run an automated script on a specific event. We can choose between pre-receive, update or post-receive hook and attach our script on any of these hooks. GIT will automatically run the script on the event of any of these hooks.

How can we determine the commit that is the source of a bug in GIT?

In GIT we can use git bisect command to find the commit that has introduced a bug in the system. GIT bisect command internally uses binary search algorithm to find the commit that introduced a bug. We first tell a bad commit that contains the bug and a good commit that was present before the bug was introduced. Then git bisect picks a commit between those two endpoints and asks us whether the selected commit is good or bad. It continues to narrow down the range until it discovers the exact commit responsible for introducing the bug.

What is git blame?

In GIT, git blame is a very good option to find the person who changed a specific line. When we call git blame on a file, it displays the commit and name of a person responsible for making change in that line. Following is a sample: $ git blame -L 12,19 HelloWorld.java ^1822fe2 (Dave Adams 2016-03-15 10:31:28 -0700 12) public class HelloWorld { ^1822fe2 (Dave Adams 2016-03-15 10:31:28 -0700 13) ^1822fe2 (Dave Adams 2016-03-15 10:31:28 -0700 14) public static void main(String[] args) { af6560e4 (Dave Adams 2016-03-17 21:52:20 -0700 16) // Prints "Hello, World" to the terminal window. a9eaf55d (Dave Adams 2016-04-06 10:15:08 -0700 17) System.out.println("Hello, World"); af6560e4 (Dave Adams 2016-03-17 21:52:20 -0700 18) } af6560e4 (Dave Adams 2016-03-17 21:52:20 -0700 19) }

What is the main difference between git diff and git status?

In GIT, git diff shows the differences between different commits or between the working directory and index. Whereas, git status command just shows the current status of working tree.

What does 'git pull' command in GIT do internally?

In GIT, git pull internally does a git fetch first and then does a git merge. So pull is a combination of two commands: fetch and merge. We use git pull command to bring our local branch up to date with its remote version.

What does 'git push' command in GIT do internally?

In GIT, git push command does following two commands: fetch: First GIT, copies all the extra commits from server into local repo and moves origin/master branch pointer to the end of commit chain. merge: Then it merges the origin/master branch into the master branch. Now the master branch pointer moves to the newly created commit. But the origin/master pointer remains there.

What is the use of git rm command in GIT?

In GIT, git rm command is used for removing a file from the working tree and the index. We use git rm -r to recursively remove all files from a leading directory.

What is the use of git status command?

In GIT, git status command mainly shows the status of working tree. It shows following items: The paths that have differences between the index file and the current HEAD commit. The paths that have differences between the working tree and the index file The paths in the working tree that are not tracked by GIT. Among the above three items, first item is the one that we commit by using git commit command. Item two and three can be committed only after running git add command.

What is git rerere?

In GIT, rerere is a hidden feature. The full form of rerere is "reuse recorded resolution". By using rerere, GIT remembers how we've resolved a hunk conflict. The next time GIT sees the same conflict, it can automatically resolve it for us.

What is git stash?

In GIT, sometimes we do not want to commit our code but we do not want to lose also the unfinished code. In this case we use git stash command to record the current state of the working directory and index in a stash. This stores the unfinished work in a stash, and cleans the current branch from uncommitted changes. Now we can work on a clean working directory. Later we can use the stash and apply those changes back to our working directory. At times we are in the middle of some work and do not want to lose the unfinished work, we use git stash command.

What is the meaning of 'stage' in GIT?

In GIT, stage is a step before commit. To stage means that the files are ready for commit. Let say, you are working on two features in GIT. One of the features is finished and the other is not yet ready. You want to commit and leave for home in the evening. But you can commit since both of them are not fully ready. In this case you can just stage the feature that is ready and commit that part. Second feature will remain as work in progress.

What is a submodule in GIT?

In GIT, we can create sub modules inside a repository by using git submodule command. By using submodule command, we can keep a Git repository as a subdirectory of another Git repository. It allows us to keep our commits to submodule separate from the commits to main Git repository.

What are the different types of Tags you can create in GIT?

In GIT, we can create two types of Tags. Lightweight Tag: A lightweight tag is a reference that never moves. We can make a lightweight tag by running a command similar to following: $ git update-ref refs/tags/v1.0 dad0dab538c970e37ea1e769cbbde608743bc96d Annotated Tag: An annotated tag is more complex object in GIT. When we create an annotated tag, GIT creates a tag object and writes a reference to point to it rather than directly to the commit. We can create an annotated tag as follows: $ git tag -a v1.1 1d410eabc13591cb07496601ebc7c059dd55bfe9 - m 'test tag'

What are ours and theirs merge options in GIT?

In GIT, we get two simple options for resolving merge conflicts: ours and theirs These options tell the GIT which side to favor in merge conflicts. In ours, we run a command like git merge -Xours branchA As the name suggests, in ours, the changes in our branch are favored over the other branch during a merge conflict.

Sometimes Maven compiles the test classes but doesn't run them? What could be the reason for it?

In Maven, Surefire plugin is used for running the Tests. We can configure it to run certain test classes. Sometimes we you may have unintentionally specified an incorrect value to ${test} in settings.xml or pom.xml. We need to look for following in pom.xml/settings.xml and fix it: <properties> <property> <name>test</name> <value>some-value</value> </property> </properties>

What are the phases in Build lifecycle in Maven?

In Maven, each build lifecycle consists of many phases. Default build lifecycle has following phases: validate: In this phase, Maven validates that the project is correct and all necessary information is available to run next phase. compile: Maven compiles the source code of the project in this phase. test: This is the phase to run unit tests on the compiled source. There should not be any need to package or deploy the code to run these tests. package: In this phase, Maven takes the compiled code and packages it in its distributable format, such as a JAR. verify: Maven runs any checks on results of integration tests to ensure that quality criteria are met. install: In this phase, Maven installs the package into local repository. After this it can be used as a dependency in other projects locally. deploy: In the build environment, Maven copies the final package to the remote repository for sharing with other developers and projects.

What is the result of jar:jar goal in Maven?

In Maven, jar:jar goal creates a jar file in the Maven build directory. Jar file is create with the name format ${project.id}- ${project.currentVersion}.jar. The id and currentVersion are mentioned in the project.xml of the project being built. jar:jar does not recompile sources. It just creates a jar from already compiled classes.

What is Build portability in Maven?

In Maven, the portability of a build is the measure of how easy it is to take a particular project and build it in different environments. A build that does not require any custom configuration or customization of properties files is more portable than a build that requires a lot of custom work to build it from scratch. Open source projects from Apache Commons are one of the most portable projects. These build can work just out of the box.

What is the difference between Inheritance and Multi-module in Maven?

In Maven, we can create a parent project that will pass its values to its children projects. A multi-module project is created to manage a group of other sub- projects or modules. The multi-module relationship is like a tree that starts from the topmost level to the bottom level. In a multi- module project, we specify that a project should include the specific modules for build. Multi-module builds are used to group modules together in a single build. Whereas in Inheritance, the parent-child project relationship starts from the leaf node and goes upwards. It deals more with the definition of a specific project. In this case a child's pom is derived from its parent's pom.

What is a Filter in Unix command?

In Unix there are many Filter commands like- cat, awk, grep, head, tail cut etc. A Filter is a software program that takes an input and produces an output, and it can be used in a stream operation. E.g. cut -d : -f 2 /etc/passwd | grep abc We can mix and match multiple filters to create a complex command that can solve a problem. Awk and Sed are complex filters that provide fully programmable features. Even Data scientists use Unix filters to get the overview of data stored in the files.

How will you remove all files in current directory? Including the files that are two levels down in a sub- directory.

In Unix we have rm command to remove files and sub-directories. With rm command we have -r option that stands for recursive. The -r option can delete all files in a directory recursively. It means if we our current directory structure is as follows: My_dir ->Level_1_dir -> Level_1_dir ->Level_2_dir -> Level_1_dir ->Level_2_dir->a.txt With rm -r * command we can delete the file a.txt as well as sub- directories Level_1_dir and Level_2_dir. Command: rm - r * The asterisk (*) is a wild card character that stands for all the files with any name.

What is the difference between the -v and -x options in Bash shell scripts?

In a BASH Unix shell we can specify the options -v and -x on top of a script as follows: #!/bin/bash -x -v With -x option BASH shell will echo the commands like for, select, case etc. after substituting the arguments and variables. So it will be an expanded form of the command that shows all the actions of the script. It is very useful for debugging a shell script. With -v option BASH shell will echo every command before substituting the values of arguments and variables. In -v option Unix will print each line as it reads. In -v option, If we run the script, the shell prints the entire file and then executes. If we run the script interactively, it shows each command after pressing enter.

How is a Docker container different from a hypervisor?

In a Hypervisor environment we first create a Virtual Machine and then install an Operating System on it. After that we deploy the application. The virtual machine may also be installed on different hardware configurations. In a Docker environment, we just deploy the application in Docker. There is no OS layer in this environment. We specify libraries, and rest of the kernel is provided by Docker engine. In a way, Docker container and hypervisor are complementary to each other.

What is the difference between Multi-tasking and Multi-user environment?

In a Multi-tasking environment, same user can submit more than one tasks and operating system will execute them at the same time. In a Multi-user environment, more than one user can interact with the operating system at the same time.

How can we work on a project where we do not have push access?

In case of projects where we do not have push access, we can just fork the repository. By running git fork command, GIT will create a personal copy of the repository in our namespace. Once our work is done, we can create a pull request to merge our changes on the real project.

What is the purpose of git stash drop?

In case we do not need a specific stash, we use git stash drop command to remove it from the list of stashes. By default, this command removes to latest added stash To remove a specific stash we specify as argument in the git stash drop <stashname> command.

What are the main elements we can find in settings.xml?

In settings.xml we can have all the configuration information for Maven. Some of the important elements are: localRepository: The value of this element is the path of this build system's local repository. The default value is ${user.home}/.m2/repository. It is used for a main build server to allow all logged-in users to build from a common local repository. interactiveMode: If it is true then Maven should attempt to interact with the user for input. If it is false then Maven does not interact with the user. Default setting is true. usePluginRegistry: If it is true Maven uses the ${user.home}/.m2/plugin-registry.xml file to manage plugin versions. By defaults it is false. offline: If it is true this build system should be able to operate in offline mode. By default it is false. This element is used for build servers that cannot connect to a remote repository due to network setup or security reasons.

What is Kernel in Unix operating system?

Kernel is the central core component of a Unix operating system (OS). A Kernel is the main component that can control everything within Unix OS. It is the first program that is loaded on startup of Unix OS. Once it is loaded it will manage the rest of the startup process. Kernel manages memory, scheduling as well as communication with peripherals like printers, keyboards etc. But Kernel does not directly interact with a user. For a new task, Kernel will spawn a shell and user will work in a shell. Kernel provides many system calls. A software program interacts with Kernel by using system calls. Kernel has a protected memory area that cannot be overwritten accidentally by any process.

What are the differences between Ant and Maven?

Key differences between Ant and Maven are: Ant is a Java library and command line toolbox for build process. Maven is a framework for many aspects of software development like- project setup, compile, build, documentation etc. Ant does not have any conventions for project structure or build processes. Maven has conventions for setting up project structure as well as for build processes. Ant is based on procedural programming. We have to write code for compilation build, copy etc. Maven is based on declarative programming. We have to just configure it for our project setup and programming. Ant does not impose any lifecycle. We need to create the sequence of tasks manually. Maven has a lifecycle for software build processes. There are well-defined phases that we can use in Maven. Ant scripts are not reusable in multiple projects. Maven has plugins that are reusable across multiple projects.

What are Excluded dependencies in Maven?

Let say a project A depends on project B, and project B depends on project C. The developers of project A can explicitly exclude project C as a dependency. We can use the "exclusion" element to exclude it. Such dependencies are called Excluded dependencies in Maven.

What are Optional dependencies in Maven?

Let say a project B depends on project C. The developers of project B can mark project C as an optional dependency by using the "optional" element. In case project A depends on project B, A will depend only on B and not on B's optional dependency C. The developers of project A may then explicitly add a dependency on C. The dependency of B on C is known as Optional dependency in Maven.

What is a transitive dependency in Maven?

Let say you have a Project A that depends on dependency B. The dependency B further depends on dependency C. So your dependency C is a Transitive Dependency of your project A. In Maven, starting from 2.0, you do not have to specify transitive dependencies. You just mention your immediate dependencies in pom.xml. Maven takes care of resolving the Transitive dependencies and includes them automatically.

What is MOJO in Maven?

MOJO stands for Maven plain Old Java Object. Every MOJO is an executable goal in Maven. It is like an annotated Java class. It specifies metadata about a goal like- goal name, phase of lifecycle for goal and parameters required by goal. A Maven plugin can contain multiple MOJOs.

How will you find the version of a plugin being used?

Maven Help Plugin has a describe goal. This can be used for listing the version of a plugin. Sample command for this is: mvn -Dplugin=install help:describe Note: In the above command replace Dplugin with the plugin prefix as the argument. Do not use the artifact ID of plugin here.

What areas of a Project can you manage by using Maven?

Maven can help us manage following areas of a project: Build Testing Release Reporting Software Change Management (SCM) Documentation Distribution

What is a central repository in Maven?

Maven central repository is a truly remote repository that is located on repo.maven.apache.org or uk.maven.org or any other third party location. This contains the jars and artifacts provided by various software providers. Central repository contains a large amount of data. Therefore it is not allowed to scrape the whole site. But you can use the relevant jars that you want for download and use in your Maven project.

How Maven searches for JAR corresponding to a dependency?

Maven first looks for a JAR related to a dependency in the local repository. If it finds it there then it stops. If it does not find it in local repo, it looks for the JAR in the remote repository and downloads the corresponding version of JAR file. From remote repository it stores the JAR into local repository.

What are the main advantages of Maven?

Maven has a long list of advantages for Software development. Some of the main advantages are: Common Project Structure: By using Maven, every developer has a common project structure that helps in understanding the code as well as developing new features in a new project. Modular Design: Maven promotes modular design that divides a complex project into multiple modules that are easier to manage. By using Maven, it is easier to manage multiple modules for build, test, release etc. Centralized Dependency Management: With Maven, each developer does not have to include the jars separately in each project or module. Maven provides a centralized dependency management that can help improve efficiency of software development. Fewer Decisions: With Maven a developer has to make fewer decisions about things unrelated to software development work. The project structure comes ready with Maven, dependency management is a uniform approach and build/release are handled by Maven. So a developer can focus on core work of developing software.

What are the three main build lifecycles of Maven?

Maven has following three build lifecycles that further contain multiple phases: clean: In this lifecycle any files generated by previous builds are removed. default: This lifecycle is used for validating, compiling and creating the application. It has multiple phases like- compile, test, package inside it. site: Maven generates and deploys the documentation of a site in this phase.

What is Maven?

Maven is a software project management tool. It is open source software from Apache software foundation. It is used for building, reporting and documenting a Software project. It is mainly based on POM (Project Object Model).

What are the main uses of a Maven plugin?

Maven is mainly a plugin execution framework. At the code of Maven all the work is done by plugins. A Maven plugin can be used for following purposes: Cleaning up the code Compiling the code Creating a JAR file Deploying the artifacts Running the unit tests Documenting the project Generating the site of a project Generating a WAR file Generate a checkstyle report

What is a local repository in Maven?

Maven local repository is a folder in your local files system in which your project's installation, dependency jars, plugins etc. are stored. Default location of Maven local repository is .m2 folder. It can be located under following location on file system: Windows - C:\Documents and Settings\{ username}\.m2 Unix/Linux/Mac - ~/.m2

Why we should not store jars in CVS (Concurrent Versions System) or any other version control system instead of Maven repository?

Maven recommends storing jars in local repository instead of CVS or any other version control system. There are following advantages of storing it in Maven repo vs. CVS: Less Storage: A repository is very large, but it takes less space because each JAR is stored only in one place. E.g. If we have 10 modules dependent on Spring jar, then they all refer to same Spring jar stored in local repository. Quicker Checkout: Project checkout is quicker from local repository, since there is not need to checkout jars if they are already present in repo. No need for versioning: There is no need to version JARS since external dependencies do not change so often.

What are the different dependency scopes in Maven?

Maven supports following dependency scopes: compile: This is the default dependency scope in Maven. The compile level dependencies are available in all classpaths of a project. These dependencies are also propagated to dependent projects. provided: This scope is similar to compile. But in this scope we expect the JDK or a container to provide the dependency at runtime. E.g. While building a web application for the Java Enterprise Edition, we can set the dependency on the Servlet API and related Java EE APIs to scope provided. The web container will provide these classes at runtime to our application. This scope is only available on the compilation and test classpath, and is not transitive. runtime: The dependency in this scope is not required for compilation. It is required for execution. It is available in the runtime and test classpaths. It is not present in the compile classpath. test: This scope is used for dependencies that are required for test compilation and execution phases. This scope is not transitive. system: This scope is same as provided scope, except that you have to provide the JAR that contains it explicitly. In this case, he artifact is always available. There is no need to look it up in a repository. import: This scope is only used on a dependency of type pom in the <dependencyManagement> section. In this case, the specified POM has to be replaced with the dependencies in that POM's <dependencyManagement> section. This scope is only available in Maven 2.0.9 or later.

Where will you find the class files after compiling a Maven project successfully?

Once Maven completes the compilation successfully, it stores the files in target folder. The default location for class files is: ${basedir}/target/classes/

What is a POM?

POM is an abbreviation for Project Object Model. This is the basic unit of work in Maven. It is an XML file with name pom.xml. It contains details of project and project configuration that are used by Maven to build the project. It also contains default values for many projects. E.g. target is the name of build directory for Java Maven project.

What is the difference between pre-receive, update and post-receive hooks in GIT?

Pre-receive hook is invoked when a commit is pushed to a destination repository. Any script attached to this hook is executed before updating any reference. This is mainly used to enforce development best practices and policies. Update hook is similar to pre-receive hook. It is triggered just before any updates are done. This hook is invoked once for every commit that is pushed to a destination repository. Post-receive hook is invoked after the updates have been done and accepted by a destination repository. This is mainly used to configure deployment scripts. It can also invoke Continuous Integration (CI) systems and send notification emails to relevant parties of a repository.

What is Rebasing in GIT?

Rebasing is the process of moving a branch to a new base commit. It is like rewriting the history of a branch. In Rebasing, we move a branch from one commit to another. By this we can maintain linear project history. Once the commits are pushed to a public repository, it is not a good practice to use Rebasing.

What is a Shell in Unix OS?

Shell in Unix is a user interface that is used by a user to access Unix services. Generally a Unix Shell is a command line interface (CLI) in which users enter commands by typing or uploading a file. We use a Shell to run different commands and programs on Unix operating system. A Shell also has a command interpreter that can take our commands and send these to be executed by Unix operating system. Some of the popular Shells on Unix are: Korn shell, BASH, C shell etc.

What is the role of open source development in the popularity of Docker?

Since Linux was an open source operating system, it opened new opportunities for developers who want to contribute to open source systems. One of the very good outcomes of open source software is Docker. It has very powerful features. Docker has wide acceptance due to its usability as well as its open source approach of integrating with different systems.

What are the common use cases of Docker?

Some of the common use cases of Docker are as follows: Setting up Development Environment: We can use Docker to set the development environment with the applications on which our code is dependent. Testing Automation Setup: Docker can also help in creating the Testing Automation setup. We can setup different services and apps with Docker to create the automation testing environment. Production Deployment: Docker also helps in implementing the Production deployment for an application. We can use it to create the exact environment and process that will be used for doing the production deployment.

What are the main features of Docker-compose?

Some of the main features of Docker-compose are as follows: Multiple environments on same Host: We can use it to create multiple environments on the same host server. Preserve Volume Data on Container Creation: Docker compose also preserves the volume data when we create a container. Recreate the changed Containers: We can also use compose to recreate the changed containers. Variables in Compose file: Docker compose also supports variables in compose file. In this way we can create variations of our containers.

What are the main features of Maven?

Some of the main features of Maven are: Simple: Maven provides simple project setup that is based on best practices. Fast: You can get a new project or module started in a few seconds in Maven. Easy to learn: Maven usage and commands are easy to learn across all projects. Therefore ramp up time for new developers coming onto a project is very less. Dependency management: Maven provides superior dependency management including automatic updates and transitive dependencies. Multiple Projects: You can easily work with multiple projects at the same time by using Maven. Large Library: Maven has a large and growing repository of libraries and metadata to use out of the box. Extensible: Maven supports the ability to easily write plugins in Java or scripting languages for extending its core functionality. Instant: Maven is online and it provides instant access to new features with very less configuration.

What are the main responsibilities of a Unix Shell?

Some of the main responsibilities of a Unix Shell are as follows: Program Execution: A shell is responsible for executing the commands and script files in Unix. User can either interactively enter the commands in Command Line Interface called terminal or they can run a script file containing a program. Environment Setup: A shell can define the environment for a user. We can set many environment variables in a shell and use the value of these variables in our program. Interpreter: A shell acts as an interpreter for our scripts. It has a built in programming language that can be used to implement the logic. Pipeline: A shell also can hookup a pipeline of commands. When we run multiple commands separated by | pipe character, the shell takes the output of a command and passes it to next one in the pipeline. I/O Redirection: Shell is also responsible for taking input from command line interface (CLI) and sending the output back to CLI. We use >, <, >> characters for this purpose.

What is the command to apply a stash?

Sometimes we want to save our unfinished work. For this purpose we use git stash command. Once we want to come back and continue working from the last place where we left, we use git stash apply command to bring back the unfinished work. So the command to apply a stash is: git stash apply Or we can use git stash apply <stashname>

What are the default locations for source, test and build directories in Maven?

The default locations are as follows: Source: src/main/java Test: src/main/test Build: Target

What is the 'Golden Rule of Rebasing' in GIT?

The golden rule of Rebasing is that we should never use git rebase on public branches. If other people are using the same branch then they may get confused by looking at the changes in Master branch after GIT rebasing. Therefore, it is not recommended to do rebasing on a public branch that is also used by other collaborators.

What is the main difference between git clone and git remote?

The main difference between git clone and git remote is that git clone is used to create a new local repository whereas git remote is used in an existing repository. git remote adds a new reference to existing remote repository for tracking further changes. git clone creates a new local repository by copying another repository from a URL.

What are the main differences between GIT and SVN?

The main differences between GIT and SVN are: Decentralized: GIT is decentralized. You have a local copy that is a repository in which you can commit. In SVN you have to always connect to a central repository for check-in. Complex to learn: GIT is a bit difficult to learn for some developers. It has more concepts and commands to learn. SVN is much easier to learn. Unable to handle Binary files: GIT becomes slow when it deals with large binary files that change frequently. SVN can handle large binary files easily. Internal directory: GIT creates only .git directory. SVN creates .svn directory in each folder. User Interface: GIT does not have good UI. But SVN has good user interfaces.

What are the main benefits of GIT?

There are following main benefits of GIT: Distributed System: GIT is a Distributed Version Control System (DVCS). So you can keep your private work in version control but completely hidden from others. You can work offline as well. Flexible Workflow: GIT allows you to create your own workflow. You can use the process that is suitable for your project. You can go for centralized or master-slave or any other workflow. Fast: GIT is very fast when compared to other version control systems. Data Integrity: Since GIT uses SHA1, data is not easier to corrupt. Free: It is free for personal use. So many amateurs use it for their initial projects. It also works very well with large size project. Collaboration: GIT is very easy to use for projects in which collaboration is required. Many popular open source software across the globe use GIT.

What are the different types of repositories in Maven?

There are mainly two types of repositories in Maven: Local Repository: This is your local folder in which a copy of your installation and dependencies is stored. Remote Repository: This is a remote folder in which jars and other build artifacts are stored. These can be located on servers within your organization. Central Remote Repository: This is the central Maven repository that is located on repo.maven.apache.org or uk.maven.org or any other third party location. This where we can find artifacts from different providers that are available for download and use. Like- Hibernate, Spring libraries etc.

What is the most popular branching strategy in GIT?

There are many ways to do branching in GIT. One of the popular ways is to maintain two branches: master: This branch is used for production. In this branch HEAD is always in production ready state. develop: This branch is used for development. In this branch we store the latest code developed in project. This is work in progress code. Once the code is ready for deployment to production, it is merged into master branch from develop branch.

How many heads can you create in a GIT repository?

There can be any number of heads in a repository. By default there is one head known as HEAD in each repository in GIT.

What are the three most popular version of git diff command?

Three most popular git diff commands are as follows: git diff: It displays the differences between working directory and the index. git diff -cached: It displays the differences between the index and the most recent commit. git diff HEAD: It displays the differences between working directory and the most recent commit

How will you create a repository in GIT?

To create a new repository in GIT, first we create a directory for the project. Then we run 'git init' command. Now, GIT creates .git directory in our project directory. This is how our new GIT repository is created.

How can we exclude a dependency in Maven?

To exclude a dependency we can add the <exclusions> tag under the <dependency> section of the pom. E.g. <dependencies> <dependency> <groupId>test.ProjectX</groupId> <artifactId>ProjectX</artifactId> <version>1.0</version> <scope>compile</scope> <exclusions> <exclusion> <!-- exclusion is mentioned here --> <groupId>test.ProjectY</groupId> <artifactId>ProjectY</artifactId> </exclusion> </exclusions> </dependency> </dependencies>

What command will you use to package your Maven project?

To package a project into a distributable format we use following command: mvn -package

How do we put a local repository on GitHub server?

To put a local repository on GitHub, we first add all the files of working directory into local repository and commit the changes. After that we call git remote add <Remote Repo URL> command to add the local repository on GitHub server. Once it is added, we use git push command to push the contents of local repository to remote GitHub server.

How will you split a commit into multiple commits?

To split a commit, we have to use git rebase command in interactive mode. Once we reach the commit that needs to be split, we reset that commit and take the changes that have been reset. Now we can create multiple commits out of that.

In GIT, how will you compress last n commits into a single commit?

Tom compress last n commits a single commit, we use git rebase command. This command compresses multiple commits and creates a new commit. It overwrites the history of commits. It should be done carefully, since it can lead to unexpected results.

What are the different shells in Unix that you know about?

Unix has many flavors of Shell. Some of these are as follows: Bourne shell: We use sh for Bourne shell. Bourne Again shell: We use bash to run this shell. Korn shell: We can use ksh to for Korn shell. Z shell: The command to use this is zsh C shell: We use csh to run C shell. Enhanced C shell: tcsh is the command for enhanced C shell.

How will you write a message with commit command in GIT?

We call following command for commit with a message: $/> git commit -m <message>

Some people use git checkout and some use git co for checkout. How is that possible?

We can create aliases in GIT for commands by modifying the git configuration. In case of calling git co instead of git checkout we can run following command: git config --global alias.co checkout So the people using git co have made the alias for git checkout in their own environment.

What are the different kinds of branches that can be created in GIT?

We can create different kinds of branches for following purposes in GIT: Feature branches: These are used for developing a feature. Release branches: These are used for releasing code to production. Hotfix branches: These are used for releasing a hotfix to production for a defect or emergency fix. How will you create a new branch in GIT?@@ We use following command to create a new branch in GIT: $/> git checkout -b <branchname>

What are the different ways to start work in GIT?

We can start work in GIT in following ways: New Project: To create a new repository we use git init command. Existing Project: To work on an existing repository we use git clone command.

How can we see the configuration settings of GIT installation?

We can use 'git config --list' command to print all the GIT configuration settings in GIT installation.

How can we rename a remote repository?

We can use command git remote rename for changing the name of a remote repository. This changes the short name associated with a remote repository in your local. Command would look as follows: git remote rename repoOldName repoNewName

How will you remove an image from Docker?

We can use docker rmi command to delete an image from our local system. Exact command is: % docker rmi <Image Id> If we want to find IDs of all the Docker images in our local system, we can user docker images command. % docker images If we want to remove a docker container then we use docker rm command. % docker rm <Container Id>

How will you check the version of Maven in your system?

We can use following command in console to check the version of Maven in our system. mvn -version

How can we know if a branch is already merged into master in GIT?

We can use following commands for this purpose: git branch --merged master : This prints the branches merged into master git branch --merged lists : This prints the branches merged into HEAD (i.e. tip of current branch) git branch --no-merged : This prints the branches that have not been merged By default this applies only to local branches. We can use -a flag to show both local and remote branches. Or we can use -r flag to show only the remote branches.

How can we see differences between two commits in GIT?

We can use git diff command to see the differences between two commits. The syntax for a simple git diff command to compare two commits is: git diff <commit#1> <commit#2>

How can we set up a Git repository to run code sanity checks and UAT tests just before a commit?

We can use git hooks for this kind of purpose. We can write the code sanity checks in script. This script can be called by pre-commit hook of the repository. If this hook passes, then only commit will be successful.

How can we see n most recent commits in GIT?

We can use git log command to see the latest commits. To see the three most recent commits we use following command: git log -3

How can your reorder commits in GIT?

We can use git rebase command to reorder commits in GIT. It can work interactively and you can also select the ordering of commits.

How can we revert a commit that was pushed earlier and is public now?

We can use git revert command for this purpose. Internally, git revert command creates a new commit with patches that reverse the changes done in previous commits. The other option is to checkout a previous commit version and then commit it as a new commit.

How can we convert git log messages to a different format?

We can use pretty option in git log command for this. git log - pretty This option converts the output format from default to other formats. There are pre-built formats available for our use. git log -pretty=oneline E.g. git log --pretty=format:"%h - %an, %ar : %s" ba72a6c - Dave Adams, 3 years ago : changed the version number

How can we skip the running of tests in Maven?

We can use the parameter -Dmaven.test.skip=true or - DskipTests=true in the command line for skipping the tests. The parameter -Dmaven.test.skip=true skips the compilation of tests. The parameter -DskipTests=true skips the execution of tests Surefire plugin of Maven honors these parameters.

How will you add a new feature to the main branch?

We do the development work on a feature branch that is created from master branch. Once the development work is ready we use git merge command to merge it into master branch.

How will you run test classes in Maven?

We need Surefire plugin to run the test classes in Maven. To run a single test we can call following command: mvn -Dtest=TestCaseA test We can also use patterns to run multiple test cases: mvn -Dtest=TestCase* test or mvn -Dtest=TestCaseA,TestCaseB,TestImportant* test

How will you delete a branch in GIT?

We use git branch -d <branchname> command to delete a branch in GIT. In case a local branch is not fully merged, but we want to delete it by force, then we use git branch -D <branchname> command.

How will you start GIT for your project?

We use git init command in an existing project directory to start version control for our project. After this we can use git add and git commit commands to add files to our GIT repository.

Why do we use git log command?

We use git log command to search for specific commits in project history. We can search git history by author, date or content. It can even list the commits that were done x days before or after a specific date.

Why do we use git reset command?

We use git reset command to reset current HEAD to a specific state. By default it reverses the action of git add command. So we use git reset command to undo the changes of git add command.

What is the purpose of git tag command?

We use git tag command to add, delete, list or verify a tag object in GIT. Tag objects created with options -a, -s, -u are also known as annotated tags. Annotated tags are generally used for release.

What is the first character of the outp in ls -l command ?

We use ls -l command to list the files and directories in a directory. With -l option we get long listing format. In this format the first character identifies the entry type. The entry type can be one of the following: Block special file Character special file d Directory l Symbolic link s Socket link p FIFO - Regular file In general we see d for directory and - for a regular file.

How can we resolve a merge conflict in GIT?

When GIT reports merge conflict in a file, it marks the lines as follows: E.g. the business days in this week are <<<<<<< HEAD five ======= six >>>>>>> branch-feature To resolve the merge conflict in a file, we edit the file and fix the conflicting change. In above example we can either keep five or six. After editing the file we run git add command followed by git commit command. Since GIT is aware that it was merge conflict, it links this change to the correct commit.

How can we see the last commit on each of our branch in GIT?

When we run git branch command, it lists all the branches in our local repository. To see the latest commit associated with each branch, we use option -v. Exact command for this is as follows: git branch -v It lists branches as: issue75 83b576c fix issue * master 7b96605 Merge branch 'issue75' testing 972ac34 add dave to the developer list

How can we configure GIT to not ask for password every time?

When we use HTTPS URL to push, the GIT server asks for username and password for authentication. It prompts us on the terminal for this information. If we don't want to type username/password with every single time push, we can set up a "credential cache". It is kept in memory for a few minutes. We can set it by running: git config --global credential.helper cache

What does a commit object contain?

Whenever we do a commit in GIT by using git commit command, GIT creates a new commit object. This commit objects is saved to GIT repository. The commit object contains following information: HASH: The SHA1 hash of the Git tree that refers to the state of index at commit time. Commit Author: The name of person/process doing the commit and date/time. Comment: Some text messages that contains the reason for the commit .

Can we create our own directory structure for a project in Maven?

Yes, Maven gives us the flexibility of creating our own directory structure. We just need to configure the elements like <sourceDirectory>, <resources> etc. in the <build> section of pom.xml.

Can we run multiple apps on one server with Docker?

Yes, theoretically we can run multiples apps on one Docker server. But in practice, it is better to run different components on separate containers. With this we get cleaner environment and it can be used for multiple uses.

Can we write compose file in json file instead of yaml?

Yes. Yaml format is a superset of json format. Therefore any json file is also a valid Yaml file. If we use a json file then we have to specify in docker command that we are using a json file as follows: % docker-compose -f docker-compose.json up

What are the different types of profile in Maven?Where will you define these profiles?

in Maven, we can have following types of Profile: Per Project It is defined in the POM itself (pom.xml). Per User We can define it in the Maven-settings (%USER_HOME%/.m2/settings.xml). Global It is defined in the global Maven-settings (${maven.home}/conf/settings.xml). Profile descriptor Descriptor is located in project basedir (profiles.xml) (It is not supported in Maven 3.0)


Set pelajaran terkait

Texas Promulgated Contract Forms

View Set

(UG)U2: 12 How did the Delegates Distribute Powers Between National and State Government

View Set