- `git init name_of_repository`
- Step 1 -> `cd into the Folder`
- Step 2 -> `run git init`
git status
-
git add --allgit add "*"
-
git add file_name
-
git add file_name1 file_name2
-
git commit -m "commit message"
-
git commit
-
git commit --amend
git stash
git log
git branch new_branch_namegit checkout new_branch_namegit branchgit reset SHA
git clone remote_location clone_namegit remote -vgit fetchgit merge origin/mastergit remote set-url <url>
git config --get remote.origin.url
git checkout experiment -- app.js
-
git checkout feature_branchgit merge -s ours --no-commit mastergit commit # Add a message regarding the replacement that you just didgit checkout mastergit merge feature_branch
-
git branch -f master dev_branch
-
git push remote +dev_branch:master
git push --delete origin <branch_name>git branch -d <branch_name>
git config branch.<branch-name>.description""
`git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git`
`cd into/cloned/fork-repo`
`git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git`
`git fetch upstream`
`git pull upstream master`
rm -rf .git- Link for solution
git config branch.<branch-name>.description
git remote <remote-name> show
git branch -a
git branch -r
git ls-remote origin
- A fully merged branch :
git branch -d <branch name> - A not fully merged branch :
git branch -D <branch name>
git push -d <remote name> <branch name>
git ls-files
git ls-files | xargs wc -l
- If the branch is in remote branches but you are not able to checkout, then it means that it is not added in Local refs
- Solution: Add the remote branch in local refs using this command:
git branch <branch-name> <remote-name>/<branch-name>
- Solution: Add the remote branch in local refs using this command:
git clone --single-branch --branch <branch-name> <repository-url>