Found 989 Articles for Software & Coding

How to add an attribute to the XML file using Powershell?

Chirag Nagrekar
Updated on 01-Mar-2021 09:56:31

6K+ Views

To add the attribute to the XML, we first need to add the Element and then we will add an attribute for it.Below is a sample of the XML file.Example           Gambardella, Matthew       XML Developer's Guide       Computer       44.95       2000-10-01       An in-depth look at creating applications with XML.     The below command will add the new element but the file won’t be saved. We will save the file after the attribute is added.$file = "C:\Temp\SampleXML.xml" $xmlfile = [xml](Get-Content $file) $newbookelement ... Read More

Explain BLOB object and tree object in Git.

kannan sudhakaran
Updated on 20-Feb-2021 09:04:17

1K+ Views

Git uses a series of BLOBs and trees to store content of the working directory of a project. Whenever we perform a commit operation, Git internally creates a series of trees and BLOBs, which is the binary representation of the project folder structure at that point in time of commit.What is BLOB?BLOB stands for Binary Large Object. Each version of a file in Git is represented as a BLOB. A BLOB holds a file’s data but doesn’t contain any metadata about the file or even its name.To understand a BLOB let us see an example.Create 3 files “file1.txt”, “file2.txt” and ... Read More

What is the short status in Git?

kannan sudhakaran
Updated on 20-Feb-2021 09:01:52

2K+ Views

The git status command returns the current state of the −Working areaStaging areaThis command returns tracked and untracked files and changes made to the repository. However, this command does not show any commit records or information. This command usually returns a status message denoting one of the following states −No commit historyUntracked filesChanges pending to be committedClean working treeModified filesDeleted filesThe syntax for using the git status command is given below −$ git statusA screenshot of the above command’s output is below. The output indicates that the file has been modified.dell@DESKTOP-N961NR5 MINGW64 /e/tut_repo (master) $ git status On branch master ... Read More

How do we stash changes in Git?

kannan sudhakaran
Updated on 20-Feb-2021 08:59:46

677 Views

This question can be rephrased as "How to save work in progress (WIP) in Git and return to it later when convenient?"The problem − When we switch branches, Git resets our working directory to contain the snapshot stored in the last commit of the target branch. For example, if we switch from feature to the master branch, Git will replace contents in the working directory with the last commit of the master branch. But if we have local changes in our working directory that we haven't committed yet, these changes will be lost. In this situation, Git will not allow ... Read More

How to compare two branches in Git?

kannan sudhakaran
Updated on 20-Feb-2021 08:57:04

2K+ Views

Collaborators will use multiple branches in order to have clearly separated codebase. At some point in time, we may have to merge these branches in order to have the resulting work in the main branch. It is important that we compare the differences in the branches before merging to avoid any conflicts. We will see a couple of different ways to compare two branches −Listing commit differences − This method shows commits that are present in a branch but unavailable in the other branch.Listing file changes − This method compares branches and displays how exactly a certain file is different ... Read More

Why is git branching fast compared to other version control systems?

kannan sudhakaran
Updated on 20-Feb-2021 08:55:03

292 Views

Branching allows us to diverge from the main line of work and work on something else in isolation. Conceptually, we can think of a branch as a separate isolated workspace. We have a main workspace called the master.We can create a feature branch and work separately on the feature branch to add more features to the project without affecting the main line of work. If there is some error in the feature branch, we can fix it without affecting other collaborator’s work. Once everything is working properly in the feature branch, we can merge it with the main line of ... Read More

How to tag a commit in git?

kannan sudhakaran
Updated on 20-Feb-2021 08:53:33

3K+ Views

The git commit is a 40-digit hexadecimal SHA1 hash. Quite often we need to bookmark a as the commit hash is difficult to memorize. This is where one can use tags. Tags can be used to name a commit. In other words, tags are labels that can be used to identify a specific commit. For e.g., “v1.0, RC1.0” are some ways to name a commit.Tags can be classified as −Lightweight TagsAnnotated TagsLightweight TagsA Lightweight tag is also known as a simple tag. These tags use a name to refer to a specific commit. Lightweight tags are private to a repository. ... Read More

What is the meaning of the ‘detached HEAD’ state in git?

kannan sudhakaran
Updated on 20-Feb-2021 08:52:17

1K+ Views

Explanation − In git HEAD is a reference pointer and points to the current commit in the current branch. The below diagram shows that there are two commits ‘Commit#1’ and ‘Commit#2’, where ‘Commit#2’ is the latest commit. Every commit in Git will have a reference to its previous commit. Here, ‘Commit#2’ will have a reference to ‘Commit#1’. The current branch is master. The master pointer points to the latest commit i.e., ‘Commit#2’. The HEAD points to the master. In other words, the HEAD points to the last commit via the master.To check where the HEAD is pointing to, we can ... Read More

What is the difference between HEAD and master in git?

kannan sudhakaran
Updated on 20-Feb-2021 08:50:31

6K+ Views

A branch in Git is a series of interrelated commits. When a repository is initialized in Git, a branch will be created by default. This default branch is called the master.Multiple branches can be created within a Git repository. When a developer starts working on a new feature of the project, he may create a new feature branch and work in isolation from the master branch. Once the feature is completed changes in that branch will be merged to the master branch. In other words, the master branch will be the main line of work. The master itself is a ... Read More

How do you view the revision history in Git?

kannan sudhakaran
Updated on 20-Feb-2021 08:48:40

1K+ Views

Let’s say you want to view all commits to the Git repository. The git log command returns all of the commits that have been made to the repository. This command lists the latest commits in chronological order, with the latest commit first.The syntax of the git log command is given below −$ git logThe following screenshot shows how to use the command to view all commits in the current repository.dell@DESKTOP-N961NR5 MINGW64 /e/tut_repo (master) $ git log commit cbc01c8399faf9063eca4ba7781d08eebbe56aaa (HEAD −> master) Author : "Kiran Date: Fri Jan 22 19:38:42 2021 +0530    file2. txt commit 8100770d7274e6bae4e252d7b3c461020b8bc5b2 Author : ... Read More

Advertisements