I found myself having to google this multiple times so I decide to write it here as a quick references for myself.
Git submodules is a way for you to keep a git repository as a subdirectory of another git repository. It’s useful when you want to incorporate and keep track of external code or framework that your project depends on. It’s like a poor man’s version of npm or cocoapods.
Here’s a quick reference on how you can change your git branch name:
If you want to rename of your current local branch:
git branch -m new-branch-name If you want to change the name of a different local branch
git branch -m old-branch new-branch-name That’s it. Bye.
Oftentimes, I forget that I have to specify the current branch name when pushing it to a remote.
For example:
$~ git push or like this
$~ git push -u origin Either way, these commands will fail since I didn’t specify the upstream branch. git will return an error similar like this:
fatal: The current branch develop has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin <INSERT BRANCH NAME HERE> To avoid this error, I have to set the upstream branch name explicitly first before pushing it to the remote repository.
To view the changes between your latest git pull
$~ git pull origin $~ git diff @{1}.. @{n} means the n-th previous value of HEAD. You can refer the official docs on reflog Shortnames for more.
p/s: I am currently trying to dissociate myself from becoming too dependent on SourceTree for daily git operations.