Git - Version Control System (tools) which helps to track changes in the code.
GitHub - Website / Repository that allows developers to store and manage code using Git.
git --version
ls
list hidden files
ls -a
pwd
git config --global user.name "Name"
git config --global user.email "Email-ID"
git config --list
local - laptop/PC
remote - github repisoritory
git clone <- link ->
git status
change: modified
new file: untracked
add: staged
after add, commit happens (unchanged)
untracked: new files that git does not yet tracked.
modified: changed
staged: file is ready to be commited
unmodified: unchanged
add: adds new or changed file in your working directory to the Git staging area.
git add <- file name ->
git add . < add all files >
git commit -m "some message"
Transmit local branch commits to the remote repository branch
git push origin main
git push [alias] [branch]
init - used to create a new git repo
git init
git remote add origin <- link ->
git remote -v (to verify remote)
git branch (to check branch)
git branch -M main (to rename branch)
git push origin main
-u is written to specify upstrem. That meanswe will only going to to push on main branch. Now only git push should be written instead of git push origin main
git push -u origin main
git push
git branch (to check branch)
git branch -M main (to rename branch)
git checkout <-branch name-> (to navigate)
git checkout -b <-new branch name-> (to create new branch)
git branch -d <-branch name-> (to delete branch)
git merge <-branch name-> (to merge 2 branches)
create a PR (Pull Request - It lets you tell others about changes you have pushed to a branch in a repository on GitHub) used to fetch and download content from a remote repo and immediately update the local repo to match that content.
git pull origin main An event that take place when Git is usable to immediately resolve differences in code between two commits. staged changes
git reset <-file name->
git reset
Commited changes (for 1 commit) git reset HEAD~1
commited changes (for many commits)
git reset <-commit hash->
git reset --hard <-commit hash->
a fork is a new repository that shares code and visibility settings with the original "upstream" repository.
Fork is a rough copy.
git log