Overview Of Git Repository Operations
A GIT repository allows performing various operations on it, to create different versions of a project. These operations include the addition of files, creating new repositories, committing an action, deleting a repository, etc. These modifications will result in the creation of different versions of a project.
Git Repository Areas ( Working Area, Stagging Area And Commit Area )
After performing various modifications on a file in the Working Area, GIT needs to follow two more steps to save these changes in the local repository. These steps are:
- Adding the changes to the Index(Staging Area)
- Committing the indexed changes into the repository
Moving From Working Area To Stagging Area Of A Git Repository
Adding changes to the Index This process is done by the use of git add command. When the changes have been made in the Working Tree/Area. These changes need to be added to the Staging Area for further modification of the file. git add command adds the file in the local repository. This stages them for the commit process.
Syntax And Usage Of `git add`
$ git add file_name
The following are the different ways to use add command:
- To add all the working area files in the current repository to the stagging Area following command is used:
$ git add .
- To add a specific list of files to the staging area.
$ git add --all
- To add all files with extension .txt of the current directory to a staging area.
$ git add *.txt
- To add all text files with .txt extension of the docs directory to staging area.
$ git add docs/*.txt
- To add all text files of a particular directory(docs) to staging area.
$ git add docs/
- To add all files in a particular directory(docs) to staging area.
$ git add “*.txt”
Moving From Staging Area To Commit Area In A Git Repository
To add text files of entire project to staging area. Committing changes from the Index Committing process is done in the staging area on the files which are added to the Index after git add command is executed. This committing process is done by the use of git commit command. This command commits the staged changes to the local repository.
Syntax And Usage Of `git commit`
$ git commit -m "Add existing file"
- This commit command is used to add any of the tracked files to staging area and commit them by providing a message to remember.
What Is a GIT Repository?
The repositories of Github act as essential places for storing the files with maintaining the versions of development. By using GitHub repositories developers can organize, monitor, and save their changes of code to their projects in remote environments. The files in the GitHub repository are imported from the repository into the local server of the user for further updations and modifications in the content of the file. In this article, we will go through a detailed understanding of the GitHub repository and its workflow.
Table of Content
- What Is Git?
- Features Of Git
- Version Control With Git
- Understanding The Working Tree In A Git Repository
- Overview Of Git Repository Operations
- Cloning And Synchronizing With Remote Repositories
- Git Push And Pull Commands
- Additional Git Commands
- Conclusion
- Git Repository – FAQs
Contact Us