Creating a repository and committing files.

Repository can be created in two ways :
1. Take a local directory which is not under version control and convert it into GIT directory which is under version control
2. Take a online repository which already has files in it and clone it to your system.

  1. Making you own new repository (command : git init) and adding files to it (command : git add <fileName>)
git init
git add file1
git add -A //all file shorthand
git add --all
git commit -m "Fist Commit"

2. Cloning files from an online repository

git clone

We recommend you to use -o attribute with the git clone command so that we can rename the default short name that is orgin with some other value so that we can identify it more clearly.

git clone <url> -o <new short name>

Committing files directly in GIT (Skipping the staging area)

As we saw in the above example we can commit files into git using command git -m “Commit”, but only if the files are added to the staging area. If you want to directly commit a file without adding it into the staging area you can also do that but this type of commit commits all the files that are modified directly, it is a bit risky to add all the files hence you need to be sure before doing such type of commits.

git commit -a -m "Committing files directly into GIT, skipping the staging area"

Leave a Comment