Git Codes

A    for config name, Emails :

git config --global user.name Suppandi

git config --global user.email De............u@gmail.com

B    for checking email, name:

git config --global user.email

git config --global user.name

for ignoring files 

add them to .gitignore folder

for ignoring extention 

add *.extention 

*.c



C     more codes

code .                                                 opening vs code

  1. code .
  2. git init                                        for initiliase
  3. ls -lart                                        show all folders
  4. git status                                    show file status 
  5. git add file.c                              for adding a file named file.c
  6. git commit                                 for commiting a git , message will be added in vim editor later
  7. git commit -m "message"         for commiting with message
  8. touch newfile.cpp                      for adding new blank file name newfile.cpp(with extention)
  9. git add -A                                  for adding all untracked file to staged area
  10. clear                                           for clearing terminal
  11. git checkout file.c                     get back to initail staged position to last commit for file.c
  12. git checkout -f                          get back to all modifed file to last commit
  13. git log                                        tell what you have commited
  14. git log -p -n                              to see last n commit n is numerical
  15. git diff                                      compare working tree with staging area
  16. git diff --staged                         comparing current commit to just before commit
  17. git commit -a -m "message"     adding and commit together
  18. git rm --cached newfile.cpp     removing newfile.cpp form tracked ie shifting to untracked
  19. git rm newfile.cpp                    removing then deleting newfile.cpp
  20. q                                                exit log
  21. git status -s                                seeing only current wprking file status 
  22. git clone                                   to clone a repo in new directory
  23. git restore                                 restore working tree files
  24. git mv                                       move or rename a file or directory
  25. git bisect                                     use search to find the commit that introduce a bug
  26. git grep                                     print lines matching a pattern
  27. git show                                  show various type of objects 
  28. git merge br.name                   to merge br.name branch to current one (both must be at fully commit state)
  29. git branch --delete br.name    to delete branch br.name
  30. git branch -D br.name             to deleat branch br.name even if not completely merrged 
  31. we run cat ...... command t\for details of ssh key (the deploy it to add one
  32. git remote add upstream url     for featching others updates
  33. git remote remove nameofrem   removing remote
  34. git remote -v                             for checking remotes
  35. git checkout -b branch _nme    adding new branch and going int it as well
  36. git rm file-path        : deleating a file whose path (including it) is "filepath"
  37. gcc file.name -o file : will creat a exe file of file.name by name of"file"
  38. git push origin master -u  : for making push as default
  39. git pull origin master  : for pulling master barnch from origin to current branch

Comments