Kannan sudhakaran has Published 20 Articles

What are the best practices for committing in Git?

kannan sudhakaran

kannan sudhakaran

Updated on 20-Feb-2021 08:44:41

184 Views

Following are the best practices for committing in Git −Make small, single−purpose commitsCommitting small sections of code helps the team to understand what work has been completed. It is easier to revert smaller commits and helps you maintain a stable codebase. A commit should act like a wrapper around a ... Read More

What are the commonly used methods to auto-generate the .gitignore file?

kannan sudhakaran

kannan sudhakaran

Updated on 20-Feb-2021 08:42:47

1K+ Views

The .gitignore file is a text file that tells Git which files or folders should be ignored while committing changes to the repository. This file lists the project files that we do not want Git to track for us.Following are the two commonly used methods to auto−generate the .gitignore file ... Read More

How to ignore a previously committed file in Git repository?

kannan sudhakaran

kannan sudhakaran

Updated on 20-Feb-2021 08:39:57

4K+ Views

The .gitignore file does not operate on files that are already committed. To ignore changes to a file that was accidentally staged or committed the following should be done −Step 1 − Remove such files or directories from the staging areaStep 2 − Commit changes in the repositoryStep 3 − ... Read More

What is the purpose of the .gitignore file?

kannan sudhakaran

kannan sudhakaran

Updated on 20-Feb-2021 08:37:13

1K+ Views

When a Git project is compiled it may generate binary files, lock files, temporary files and metadata files. These are intermediate files that are not part of the source code. For example, IDE config files or intermediate files like “.class”, ”.exe”, “.bin” etc. that are generated during compilation should be ... Read More

How to remove a committed file from the Git repository?

kannan sudhakaran

kannan sudhakaran

Updated on 20-Feb-2021 08:35:06

989 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 ... Read More

What are the steps to rename a file in Git?

kannan sudhakaran

kannan sudhakaran

Updated on 20-Feb-2021 08:33:12

3K+ 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 ... Read More

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

kannan sudhakaran

kannan sudhakaran

Updated on 20-Feb-2021 08:31:42

4K+ 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 ... 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 08:29:40

2K+ 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 ... Read More

What is .git folder and why is it hidden?

kannan sudhakaran

kannan sudhakaran

Updated on 20-Feb-2021 08:26:14

17K+ 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 ... Read More

How to change the default configuration in Git?

kannan sudhakaran

kannan sudhakaran

Updated on 20-Feb-2021 08:24:06

615 Views

The default configuration should be modified when you use Git for the first time. The git config command can be used to achieve the same. The following are some Git configuration settings that can be set −NameEmailDefault EditorLine EndingsGit allows us to configure the above settings at different levels. This ... Read More

Advertisements