Skip to content

Instantly share code, notes, and snippets.

@yogeshgosavi
Last active February 5, 2021 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yogeshgosavi/3d16a0c1c7e9998a2c18698f0c3b917c to your computer and use it in GitHub Desktop.
Save yogeshgosavi/3d16a0c1c7e9998a2c18698f0c3b917c to your computer and use it in GitHub Desktop.
Git command for nooob
#install git on command line
sudo apt-get install git
#configure terminal
git config --global user.name "Your Name Here"
git config --global user.email "your_email@youremail.com"
#clone your repo
git clone giturl -b branch /folder/
# pull letest changes
git pull <original repo URL> <branch name>
#how to cherry pick
git remote add endel giturlofrepoUwanToCherryPickFrom
#fetch branch ( endel is name)
git fetch endel
#list their commits
git log endel/master
#cherry pick commit
git cherry-pick HashValue
#check commit status to resolve conflicts
git status
#add commit after conflict resolve
git add .
or
git add -A
#Add Message for commit
git commit -M "msg"
#Add Authorship
git commit -M "msg" --author="Username<userid@email>"
#Push Changes to master
git push origin master
#how to revert commit?
git revert <commit ID>
#reset the repo to the previous state , git stash reset local changes
git stash
#hard reset repo
git reset --hard <commit ID>
#force push
git push -f <URL name> <branch name>
#git abort
git merge --abort
#create branch on command line
$ git checkout -b [name_of_your_new_branch]
#put branch on git
$ git push origin [name_of_your_new_branch]
https://forum.xda-developers.com/android/help/test-t3515907
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment