How to use GIT
- Download git
- Configure git
- Create Git repository
- Create and Commit a file
- Push to the Repo
git –version
git version 2.7.4
(your version)
cd car-git-demo
Next, create a local git
repository for the project using:
git init
04.Create and commit a file
You can add a file the git folder
or create a new by using touch command:
touch index.html
(File name)
Now, use git status to
get the status of the working tree:
git status
Git will respond that nothing has been committed, but the directory does contain a new file. That means you have to commit your file.
But before committing you have to add files:
git add . / git add
index.html
add . (will add all the files)/add index.html (only add specific file)
Finally, you have to commit
changes:
git commit -m "Initial
Commit" (any name)
You can use the “git status” to check status again after the commit and "git log" to view your commit history.
05. Push files to the Repository
To push all your work to your repository
you can use this command:
git remote add origin yourLink
git push -u origin master
Comments
Post a Comment