Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

To cherry-pick a commit

git cherry-pick <commit-hash>

to check on which branch you are if confused


git log --first-parent ---> this shows the parent brnach

to checkout a particular file in a commit


git checkout <previous commit id> -- filename

to clone the repo


git clone --recurse-submodules ssh://git@bitbucket-il:7999/p5g/cu.git CU

if you didn't use --recurse-submodules then do the following


git pull --recurse-submodule
git submodule update --init
git submodule update --recursive –remote

to change the git config:


1. git config --global user.name "Sam Smith"
2. git config --global user.email sam@example.com
3. git config --local user.name "Sam Smith"
4. git config --local user.email sam@example.com

to revert a commit
git revert <commit hash> and then git push will do it

To change author of existing commit


git commit --amend --author="Author Name <email@address.com>"
git commit --amend --author="Mayuri Patil <mapatil@airspan.com>"

git branch -d 19_00_271_1_70_build -- to delete local branch

How to squash the commit?


=====================
1.git rebase -i HEAD~2 (2 means top 2 commit we want to merge)
2.Then editor will be opened in that first one will be latest commit. For all
subsquent commit right squash.
3.Save and close
4.The next file will be opened there Edit the commit message
5.Save and close.
6.Do git push --force.

You might also like