Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
January 24, 2023 06:47 am GMT

Git Basic Commands That You Need For Regular Project Work

I am trying to list some commands above the work criteria. Check this below

Git Initial Command:

1. git init2. git status3. git --version4. rm -rf .git  //Remove git folder5. git status -s

Git Configuration Command:

1. git config --global user.name "username"2. git config --global user.email "email"3. git config --list4. git config --global alias.last "log -p -1"  //Create alias for shortcut

Git File Add Command:

1. git add .   //Stages new and modified file without deleted file2. git add -A  //Stages all file3. git add -u  //Stages modified and deleted file without new file

Git Commit Command:

1. git commit -m "messeage"2. git commit -a -m "message"  //Stage file commit without add3. git commit --amend          //Change the last commit

Git Commit Log Command:

1. git log2. git log -p -23. git log --stat4. git log --pretty=oneline5. git log --pretty=short/full6. git log --pretty=format:"%h 00 %ae"7. git log --since=2.days/weeks/months/years

Git Branch Command:

1. git branch2. git branch `branchName`3. git checkout `branchName`4. git merge `branchName`                 //Branch must be master5. git branch -v6. git branch --merged7. git brach --no-merged8. git branch -d `branchName`             //Locally deleted9. git push origin --delete `branchName`  //Deledted on github10. git checkout -b "branchName"          // Create brach and switch to the created branch

Git Compare Command

1. git diff `fileName`           //Difference tracked file code between last commit file to now2. git diff --staged `filename`  //Difference Stages file code between last commit file to now3. git reset `fileName`          //Stages file to unstages file4. git checkout `fileName`       //Clear file to last commit5. git checkout -f               //For all file6. git rm --cached `fileName`    //Tracked file to Untracked file

Git Command For Github

1. git remote add origin `url`2. git remote rm origin3. git push -u origin master4. git pull origin master5. git remote -v6. git clone `url`

Git Extra Command

1 .gitignore2. git rm `fileName`3. git mv `fileName1` `fileName2`  //Change the filename & fileName2 is changed name.

NOTE: If you don't understand any command, find out on Google. This way you can learn about git commands properly and have a crystal clear idea on git commands. Keep exploring.


Original Link: https://dev.to/azadulkabir455/git-basic-commands-that-you-need-for-regular-basic-project-work-3b15

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To