git help config git config --global user.name "golam chowdhury" git config --global user.email [email protected] git config --global color.ui true
creates local repo
what is changed after last commit
for start tracking on the file and to add changes to staging
for committing the changed to
local repo
[staging to repo]
adds all new or modified files to staging
git add <list of files>
git add -all
git add *.txt
git add docs/*.txt
git add docs/
git add '*.txt'
to show history
changes vs staging
staging vs local repo
to un-stage the file (the version from time-line Head replaces the staging version, but the file changes are there in local file system)
blow away all changes in this file since last commit
To stage+commit same time, does not include new files [un-tracked]
reset into staging (rollback last commit, HEAD^ is the previous state of HEAD)
this commit will merge with last commit and overwrite commit message
blow away last commit and all changes
blow away last two commits and all changes
git remote add origin https://aaaadfdfd.git
adding remote named 'origin'. this adds the mapping {origin:address} to local repo
adding new remote
removing remote
'local branch' to 'remote push' [ if -u is used, next time only git push will work ]
- creates local directory and repo
- adds the 'origin' remote pointing it to clone URL
- checks out initial branch (likely master) and sets the head
lists all remotes
creates a new branch
shows branch list and current branch with a *
switches branch
list files in this branch
merges f2018 into current branch, its a 'fast forward' merge if original branch was not modified meantime
removing branch f2018 (when you are done it by merging it to master)
created a branch named feat and checked it out
'git fetch' and then merges the origin/master to master
- git fetch
- git merge origin/master
after resolving conflicts manually, to do 'merge commit'
newly created shoppping_cart branch is pushed to remote, 'origin' , so that others can work on it
list all remote branches
Branch shopping_cart set up to track remote branch shopping_cart from origin. Switched to a new branch 'shopping_cart' (another developer does this.)
branch 'admin' set up to track remote branch 'admin' from 'origin' (means local 'admin' merges with remote 'admin')
how to rename a local branch
deletes remote branch shopping_cart, but keeps the local intact
deletes local branch shopping_cart if changes are merged to some other branch, if not, it shows warning
then deletes the local branch, even if there are unmerged changes in this branch