Git - Notes
Git - Notes
To modify the global settings in editor , until visual studio code editor closed this didn’t allow to type other
command .
Core.autocrlf : This is used by avoid issues while checkin from windows and MacOS
For windows
Staging area/ index is existed in git , it is used to pre check before doing commit to our repository.
If file is in edit mode, staging area will contain the old file ,to update it we need to run git add
If we deleted a file using “rm” ,we need to update them in staging area before doing removal.
Commit using message –m
To rename or move file ,it effect both working directory and staging
To avoid folder or files that shouldn’t track by git , create a file .gitignore
If existed file had modification , then M will display before a file ,?? Is new files that not added to staging area
For first time , every developer clone to git (Copy code from repository).
Git will track all files, if files are tracked then it is Tracking and files are not tracked then it is Untracking .
-u represents – Upstream .
Note: If we want to include one javascript file among all files ,we should use negation operator .
For e,g: if you want to show main.js
!main.js should include .gitignore
After commit done for new file nav_bar.html , HEAD will point to side-menu branch commit as below
Git log always give current branch commit list. If we want to get all branch list we have to use
Git log –oneline –all
Remote branching
To know name of remote server
New file will stay under remotes/origin/master , we need to pull that file
To pull from origin/main
Fetch command fetch file and store in remote then we need to merge file.
In pull command we need can fetch and pull the file into our master /main branch
Rebasing is the process of moving or combining a sequence of commits to a new base commit.
Rebasing is most useful and easily visualized in the context of a feature branching workflow. ... This
gives the later benefit of a clean merge of your feature branch back into the master branch.
Git rebase branch
Git mergetool – this open p4 merge tool we consider one of the change to commit
Git rebase continue
Git commit –m “comment”
Git stash always consider staged files only. It can’t add /track untracked files.
Git stash –u // This is used to add untracked files into stash.
Above command make dry run and list all files which will remove ,if I run clean command .