Git command:
This blog sites has many Git command which can be directly or indirectly use during professional work.
Git installation: for git installation please watch this below following link : What is Git – How to Install and Configure Git
##Version Checks:
git –version
##global user add & email ID add”
git config –global user.name “Sachin Kumar Singh”
git config –global user.email “sachinbiher@gmail.com”
## validation
git config –global user.email
git config –global –edit
## to validate status
git status
## adding file to staging
git add file.
git add portal
git status
### git commit from staging
git commit -m “First Commit”
## git logs checks
git log
push code on git hub
git remote –
Example of command
sachi@LAPTOP-U73LM1MH MINGW64 ~/ubidgit (master) $ git remote -v sachi@LAPTOP-U73LM1MH MINGW64 ~/ubidgit (master) $ git remote add origin https://github.com/sachinbiher/ubidgit.git sachi@LAPTOP-U73LM1MH MINGW64 ~/ubidgit (master) $ git remote -v origin https://github.com/sachinbiher/ubidgit.git (fetch) origin https://github.com/sachinbiher/ubidgit.git (push) sachi@LAPTOP-U73LM1MH MINGW64 ~/ubidgit (master) $ git branch -M master sachi@LAPTOP-U73LM1MH MINGW64 ~/ubidgit (master) $ git push -u origin master Enumerating objects: 12110, done. Counting objects: 100% (12110/12110), done. Delta compression using up to 4 threads Compressing objects: 100% (8877/8877), done. error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8) remote: fatal: pack exceeds maximum allowed size (2.00 GiB) send-pack: unexpected disconnect while reading sideband packet Writing objects: 100% (12110/12110), 2.28 GiB | 10.65 MiB/s, done. Total 12110 (delta 2912), reused 12110 (delta 2912), pack-reused 0 fatal: the remote end hung up unexpectedly Everything up-to-date sachi@LAPTOP-U73LM1MH MINGW64 ~/ubidgit (master) $ git branch -M master sachi@LAPTOP-U73LM1MH MINGW64 ~/ubidgit (master) $ git remot add orgin git: 'remot' is not a git command. See 'git --help'. The most similar command is remote sachi@LAPTOP-U73LM1MH MINGW64 ~/ubidgit (master) $ git remote origin sachi@LAPTOP-U73LM1MH MINGW64 ~/ubidgit (master) $ git remote add origin https://github.com/sachinbiher/ubidgit.git error: remote origin already exists. sachi@LAPTOP-U73LM1MH MINGW64 ~/ubidgit (master) $ git remote add origin usage: git remote add [<options>] <name> <url> -f, --fetch fetch the remote branches --tags import all tags and associated objects when fetching or do not fetch any tag at all (--no-tags) -t, --track <branch> branch(es) to track -m, --master <branch> master branch --mirror[=(push|fetch)] set up remote as a mirror to push to or fetch from
Clean up all directories : Deletion of all directories.
cd /tmp
git clone /your/local/rep # make a temp copy
cd rep
git rm -r * # delete everything
cp -r /your/local/rep/* . # get only the files you want
git add * # add them again
git status # everything but those copied will be removed
git commit -a -m ‘deleting stuff’
cd /your/local/rep
git pull /tmp/rep # now everything else has been removed