Git commands

Git commands

All the git related data is stored in the hidden directory ” .git ”

Hidden directory in windows10

  • Select View > Options > Change folder and search options.
  • Select the View tab and, in Advanced settings, select Show hidden files, folders, and drives and OK

init

To initialize the git repository from inside directory

git init

To initialize the git repository from outside directory

git init <directory> 

clone

To clone the project from remote repository

git clone  <repo url>

eg: repo url https://github.com/DevTuple/react-typescript-fluentui-starter.git

add

To add the file for next commit

git add <file name>

To add all the current directory files for next commit

git add .

commit

To commit changes to stage area (local repository)

git commit

To commit changes with commit comment

git commit -m "<comment for the commit>"

push

To push changes to remote repository

git push

To push new project to remote repository

cd <project directory>
git init
git add .
git commit -m "<comment for commit>"
git remote add origin <repository url>
git push -u origin master

To push an existing repository

git remote add origin <repository url>
git branch -M master
git push -u origin master

eg: repository url – “https://github.com/DevTuple/react-typescript-fluentui-starter.git

原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/240854.html

(0)
上一篇 2022年3月3日 17:20
下一篇 2022年3月6日 11:38

相关推荐

发表回复

登录后才能评论