Software & Coding Articles

Page 47 of 83

How to remove a committed file from the Git repository?

kannan sudhakaran
kannan sudhakaran
Updated on 20-Feb-2021 1K+ Views

Git allows you to delete a file from the repository using any of the following methods −Using the Linux rm commandUsing the git rm commandScenario 1 − Use the Linux rm commandThe syntax of the Linux rm command is −$ git rm Let us assume that a file “file1.python” exists in the repository. Use the Linux rm command to delete the file − “file1.python”.$ git rm file1.pythonLet us first verify if the file has been removed from the working directory. This can be verified by using the Linux ls command.$ lsThe output suggests that the file has been removed from ...

Read More

What are the steps to rename a file in Git?

kannan sudhakaran
kannan sudhakaran
Updated on 20-Feb-2021 4K+ Views

A file can be renamed in the following two ways −Use the mv Linux commandUse the git mv commandScenario 1 − Use the Linux mv commandThe following example assumes that a file “file1.txt” exists in the repository. The syntax for using the Linux mv command is −$ mv Use the Linux command mv to rename the file to “file1.java”.$ mv file1.txt file1.javaExecute the git status command to verify the file’s status in Git.$ git statusThe output in the screenshot suggests that the file has been renamed in two steps −“file1.txt” has been deleted from the working areaA new file ...

Read More

Why should you use git add command before using git commit command?

kannan sudhakaran
kannan sudhakaran
Updated on 20-Feb-2021 5K+ Views

The git add command adds files to the staging area whereas the git commit command will write changes to the repository permanently.When you have completed an important feature, you will need to create a snapshot of that change and save it to the Git repository. To achieve this, you will perform a commit.In Git, there exists an intermediate step before commit which does not exist in other version control systems. This intermediate step is called a staging area. The staging area is also known as the index. The staging area can be used to build up a set of changes ...

Read More

How do you handle End-of-Line characters in Git on Windows / Linux / Mac Operating Systems?

kannan sudhakaran
kannan sudhakaran
Updated on 20-Feb-2021 3K+ Views

This question can also be rephrased as − How do you resolve the Git warning − "LF will be replaced by CRLF"?The End−of−Line is marked using two special characters "\r" in Windows Operating System while the “" character is used to mark End-of-Line in MacOS and Linux systems.The \r and are known as the Carriage Return (CR) and Line Feed (LF) characters respectively. It is important to handle End-of-Line characters properly for consistency across multiple Operating Systems.End−of−Line characters can be configured in two ways −At the time of installation −At the time of installation, Git allows us to select from ...

Read More

What is .git folder and why is it hidden?

kannan sudhakaran
kannan sudhakaran
Updated on 20-Feb-2021 22K+ Views

Git is currently the most popular version control system. A version control system records the changes made to our project codebase in a special kind of file system-based database. In Git, this database is known as a repository and its structure is inspired by the Linux file system. The repository maintains a history of the changes to our codebase.The .git folder contains all information that is necessary for the project and all information relating commits, remote repository address, etc. It also contains a log that stores the commit history. This log can help you to roll back to the desired ...

Read More

How to add a new element in the XML using PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 19-Feb-2021 10K+ Views

Suppose we have a XML file as shown below.           Gambardella, Matthew       XML Developer's Guide       Computer       44.95       2000-10-01       An in-depth look at creating applications with XML.     We need to add a new node. So we will first load the XML file and then operate on it as shown below.The below command will save the XML file to the variable.$xmlfile = [XML](Get-Content C:\Temp\SampleXML.xml)The below command will create a new XML element$newelement = $xmlfile.CreateElement("book")Once the element is created we need ...

Read More

How to run Invoke-Command in PowerShell Workflow?

Chirag Nagrekar
Chirag Nagrekar
Updated on 19-Feb-2021 2K+ Views

To run Invoke-Command in PowerShell Workflow we need to use the InlineScript block because Invoke-Command is not supported directly in the workflow. The below example is without using the InlineScript block we get an error.ExampleWorkflow TestInvokeCommand{    Invoke-Command -ComputerName LabMachine2k16 -ScriptBlock{       Get-Service WINRM    } }Output −At line:2 char:5 +    Invoke-Command -ComputerName LabMachine2k16 -ScriptBlock{ +    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Cannot call the 'Invoke-Command' command. Other commands from this module have been packaged as workflow activities, but this command was specifically excluded. This is likely because the command requires an interactive Windows PowerShell session, or has behavior not suited ...

Read More

How to remove Windows service with PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 19-Feb-2021 6K+ Views

We need to remove the window service named TestService using PowerShell. If you are using PowerShell 6.0 or above version, you can directly use a cmdlet Remove-Service command as shown below.In this example, we have a service name called TestService.Remove-Service Testservice -Confirm:$false -VerboseIf you are using the PowerShell framework version (5.1 or below), you need to use the registry. Services are stored in the registry at the below location.HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\To delete the service, we need to remove that service key with the command as shown below.Get-Item HKLM:\SYSTEM\CurrentControlSet\Services\TestService | Remove-Item -Force -Verbose Here we are using the Service name TestService and you need to reboot the server ...

Read More

How Parallel and Sequence execution works in PowerShell Workflow?

Chirag Nagrekar
Chirag Nagrekar
Updated on 19-Feb-2021 1K+ Views

PowerShell workflows are the best way to design the script to execute on more than one node parallel which saves extensive time for the output to produce but we always don’t want to run all the commands parallel but also need some of them to run sequentially and we can design both Parallel and Sequence commands using PowerShell Workflow.Workflow TestWorkflow{    parallel{       Command1       Command2    }    Sequence{       Command3       Command4    } } TestWorkflowIn the above code, Command1, Command2 will be executed parallelly in any order while command3 ...

Read More

What is the PowerShell Workflow?

Chirag Nagrekar
Chirag Nagrekar
Updated on 19-Feb-2021 534 Views

PowerShell workflow is built on the .Net based Windows Workflow Foundation (WWF) and it has a separate Workflow engine to execute the code because it translates code into XAML for the WWF framework.PowerShell workflow is series of steps that is mainly used forRunning activities parallelly on more than one machine.Long-running scripts.Structuring steps (Which steps will execute parallel and which in sequence)Frequently used tasks.Resuming the script from where it was terminated due to system failure or any other interruption by defining checkpoints.The PowerShell workflow was introduced in PowerShell 3.0 and discontinued for windows in the Core version (6.0 onwards) and only ...

Read More
Showing 461–470 of 825 articles
« Prev 1 45 46 47 48 49 83 Next »
Advertisements