0
531views
Describe various GIT operations on local and Remote repositories?
1 Answer
0
1views

Git init

$git init git init turns any directory into a Git repository. git init is one way to start a new project with Git. To start a repository, use either git init or git clone - not both. To initialize a repository, Git creates a hidden directory called .git. That directory stores all of the objects and refs that Git uses and creates as a part of your project's history. This hidden .git directory is what separates a regular directory from a Git repository. **Git Status: Inspecting a repository** git status git tag git blame $git status

The git status command displays the state of the working directory and the staging area. It lets you see which changes have been staged, which haven’t, and which files aren’t being tracked by Git. The status output does not show you any information regarding the committed project history. For this, you need to use the git log.

Git config

 Git uses a username to associate commits with an identity

 Git username is not the same as your GitHub username

 The new name you set will be visible in any future commits you to push to GitHub from the command line

 $ git config - -global user.name ‘Swati’  $ git config - -global user.email ‘[email protected]

Git add

 The git adds command adds a file to the Git staging area. This area contains a list of all the files you have recently changed. Your repository will be updated the next time you create a commit with your changes.  

 Therefore, running the git add command does not change any of your work in the Git repository. Changes are only made to your repository when you execute the git commit command.

 The syntax for the git add command is as follows:

 git add filename

 The file you specify can be any file or folder in your Git repository.

 Suppose we want to add a file called README.md to the staging area because we want to commit it to our main repository. We can do so using this code:

 $git add README.md

Git commit

 In Git, commit is the term used for saving changes.

 Git does not add changes to a commit automatically. You need to indicate which file and changes need to be saved before running the Git commit command.

 The commit command does not save changes in remote servers, only in the local repository of Git.

Committing Changes

 Git commits command takes a snapshot representing the staged changes.

 git commit

 After running the Git commit command, you need to type in the description of the commit in the text editor.

 This Git commit example shows how you set the description with the commit function:

Please Improve the formatting


Please log in to add an answer.