Download the Terminal from here
git config --global user.name “Your Name”
git config --global user.email “Youremail@anything.com”
git init
git remote add origin [repoLink]
git remote -v
git add .
git commit -m "[your message]"
git push origin [branchName]
git clone [forkedRepoLink]
git add .
git commit -m "your message"
git push origin [branchName]
git remote add upstream [originalRepoLink]
git pull upstream master
git push origin
git log --pretty=oneline
git checkout hash/branch
git reset HEAD <file>
git revert HEAD
git pull origin [branchName]
git status
git log --pretty=oneline
git diff --color thatBranchNameYouWantToCompare
git push origin --delete <branch>
git reset
git reset --hard
git reset HEAD~1
OR
git revert [last-commit-hash]
(This will create a new commit for reverted changes)
Q1-> I have pushed some commit/s that I shouldn't. Now, I want to remove them locally and remotely. I want my History on Github to be cleared of those wrong commits. What should I do ??
git log --pretty=oneline
Now, choose a number of commits you want to change i.e lets say recent 4 commits and delete them locally. Type the following command and simply remove the commits in your text editor(simply delete the line) and save the file
git rebase -i HEAD~4
Check your commit tree by using git log command and become sure that your commits have been removed locally. Once, you're certain, push the remaining commits.
git push origin branchName --force
git fetch origin
git branch -f [branchName]/[branchName]
git checkout branchName