User Tools

Site Tools


git_notes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
git_notes [2022/02/06 01:26] – [learn git] rajugit_notes [2023/05/05 14:55] (current) – [dokuwiki table syntax] admin
Line 34: Line 34:
  
 Note:- The "git merge development" command works even if you have local changes not committed to feature1. Note:- The "git merge development" command works even if you have local changes not committed to feature1.
 +
 +===== Tasks =====
 +==== Initializing git for version control ====
 +<code>
 +git config --global user.name "Kamaraju S. Kusumanchi"
 +git config --global user.email "kamaraju@gmail.com"
 +git config --global push.default matching
 +git config --global alias.co checkout
 +git init
 +</code>
 +
 +Ref:- https://codemy.com/git
  
 ===== dummy ===== ===== dummy =====
Line 63: Line 75:
 git grep -i --all-match -e '\^.*\^' -e '|.*|' git grep -i --all-match -e '\^.*\^' -e '|.*|'
 </code> </code>
 +
 +==== Count number of lines in a file but exclude blank lines ====
 +<code>
 +git grep -e "^" --and --not -e "^$" <file_name>  | wc -l
 +</code>
 +
 +For example:
 +<code>
 +$ git grep -e "^" --and --not -e "^$" dummy_1510.txt  | wc -l
 +27
 +</code>
 +
 +===== Commits related =====
 +==== amend last commit =====
 +
 +<code>
 +export EDITOR=vim
 +git commit --amend --author="Kamaraju S. Kusumanchi <kamaraju@gmail.com>"
 +git config user.email "kamaraju@gmail.com"
 +
 +git config --get-all --show-scope user.email
 +git config --get-all --show-origin user.email
 +</code>
 +
 +===== Configuration related =====
 +==== configuration files ====
 +  * https://git-scm.com/docs/git-config#FILES - talks about which files 'git config' reads from. High information density. Easy to understand.
  
 ===== git commands usage ===== ===== git commands usage =====
git_notes.1644110770.txt.gz · Last modified: 2022/02/06 01:26 by raju