git init
git add <file>
git status
git commit
git push
git pull
git clone
$ git --version
git version 2.18.0.windows.1
--- Git Bash Here ???
git init
Show hidden folders in VSCode tree UserSettings
"files.exclude": {
"**/.git": false
}
- VS CODE > CTRL+P - file open
- VS CODE > CTRL+D select next Multi cursor
- VS CODE > CTRL+K & CTRL+D --- CTRL+ALT+UP/DOWN
- Adding Email and Address To Config
git config --global user.name 'Mark Pet'
git config --global user.email '[email protected]'
q - to get out from help mode
git config --list
- add single file
git add index.html
- remove from staging area
git rm --cached index.html
- add all with type
git add *.html
- add all
git add .
- Commit Changes to Repository
git commit -a -m 'Initial Commit'
- Ignoring files is with
.gitignore
- -m message for Commit
git commit -m 'New change '
- create branch
git branch login
- Quick create empty file
touch login.html
- Switch to LOGIN branch
git checkout login
touch login.html
git add .
git commit -m 'Loging Form in Login branch'
git status
- Upon return to MASTER branch login.html file is gone!
git checkout master
- Merge to obtain login branch and login.html file
git merge --message 'AddedLogin' login
- to see all changes and commits
git log
- shortened only names and hashes in one line
git log --pretty=oneline
git log --pretty=format:"%h - %an, %ar : %s"
git log --pretty=format:"%h %s" --graph
git log --since=2.weeks
git log -S function_name
git commit --amend >>> i or :wq or :q
git commit --amend --no-edit
git remote
git remote add origin https://github.com/oodboo/Git-lectures.git
git remote
git push -u origin master
--> Your project --> Settings Tab --> "Danger Zone" (Botom of the Page) --> [Delete This Repository]
! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/oodboo/Git-lectures.git' hint: Updates were rejected because a pushed branch tip is behind its remote hint: counterpart. Check out this branch and integrate the remote changes hint: (e.g. 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
https://stackoverflow.com/questions/10298291/cannot-push-to-github-keeps-saying-need-merge
git push -f origin master
git branch -d wrongbranchname
git branch -D wrongbranchname
- To remove a remote branch (if you know what you are doing!)
git push origin :the_remote_branch
- or simply use the new syntax (v1.7.0)
git push origin --delete the_remote_branch
- perhaps someone else has already deleted the branch. Try to synchronize your branch list with
git fetch -p