What is git clone –bare command?

Sometimes we need to share out git repo instead of whole working directory. In that case git clone --bare command can be used:

git clone --bare https://some-repository-link.github.com/project.git .git

After this command in the current directory git bash only create .git (hidden) repo directory and not any of the working folder or files.

Convert from bare repo to working repo

With two steps it is very easy:

First, set the core.bare config value to false :
$ git config --bool core-bare false
then enter the following command to HARD reset your HEAD to initial commit and finally it will create your repos working directory:
$ git reset --hard

Previous post:

Git Commands

A list of commonly used Git commands

Getting & Creating Projects

CommandDescription
git initInitialize a local Git repository
git clone ssh://git@github.com/[username]/[repository-name].gitCreate a local copy of a remote repository

Basic Snapshotting

CommandDescription
git statusCheck status
git add [file-name.txt]Add a file to the staging area
git add -AAdd all new and changed files to the staging area
git commit -m "[commit message]"Commit changes
git rm -r [file-name.txt]Remove a file (or folder)

Branching & Merging

CommandDescription
git branchList branches (the asterisk denotes the current branch)
git branch -aList all branches (local and remote)
git branch [branch name]Create a new branch
git branch -d [branch name]Delete a branch
git push origin --delete [branchName]Delete a remote branch
git checkout -b [branch name]Create a new branch and switch to it
git checkout -b [branch name] origin/[branch name]Clone a remote branch and switch to it
git checkout [branch name]Switch to a branch
git checkout -Switch to the branch last checked out
git checkout -- [file-name.txt]Discard changes to a file
git merge [branch name]Merge a branch into the active branch
git merge [source branch] [target branch]Merge a branch into a target branch
git stashStash changes in a dirty working directory
git stash clearRemove all stashed entries

Sharing & Updating Projects

CommandDescription
git push origin [branch name]Push a branch to your remote repository
git push -u origin [branch name]Push changes to remote repository (and remember the branch)
git pushPush changes to remote repository (remembered branch)
git push origin --delete [branch name]Delete a remote branch
git pullUpdate local repository to the newest commit
git pull origin [branch name]Pull changes from remote repository
git remote add origin ssh://git@github.com/[username]/[repository-name].gitAdd a remote repository
git remote set-url origin ssh://git@github.com/[username]/[repository-name].gitSet a repository’s origin branch to SSH

Inspection & Comparison

CommandDescription
git logView changes
git log --summaryView changes (detailed)
git diff [source branch] [target branch]Preview changes before merging

How to add custom fonts in React Native

Adding / Linking fonts for IOS and Android at once

1. First step

Collect all fonts you want to use for IOS and Android and place it in the directory inside your project. For example in ./assets/fonts/

2. Second step

Add the following line in your package.json:

"rnpm": {
"assets": ["./path to your fonts"]
}
in our example path is - ./assets/fonts

3. Third step

And finally, run in terminal:

$ react-native link

After running link command you should see something like this in your terminal output:

That’s all! 💥💥💥💥💥 We are done. All your fonts are linked and can be used for both IOS and Android.

Here is a bit of explanation of what’s going on:

rnpm — is react native package manager which now is part of React Native core. For earlier usage, we would need to rewrite the third step to rnpm link, but now react-native recognize `link` command by itself.

So on third step packager links fonts in Info.plst for IOS and creates fonts directory (android/app/src/main/assets/fonts) for Android, where copies your fonts


For Full Details : https://medium.com/@danielskripnik/how-to-add-and-remove-custom-fonts-in-react-native-b2830084b0e4

Starting Android emulator from command line

Sometimes you need to start android emulator from the command line for example developing react-native apps, you may don’t want to open studio open AVD manager and start the emulator. This is the long journey process. So one of android handy tool appear here and make it simple to list existing devices or run the one desired easily.

And open Command prompt by clicking search and typing “cmd” than right click then choose “Run as administrator” item. Than goto the “emulator” directory (and may be the drive also which is android-sdk installed in my case for example it is F: drive and the directory located root of F: drive). And after that opening enter the following command to list all existing emulators:

C:\windows\system32>f:
f:\>cd android\sdk\emulator
f:\android\sdk\emulator>emulator.exe -list-avds
4.65_720p_Galaxy_Nexus_API_15
7_WSVGA_Tablet_API_24
Android_Accelerated_x86_Oreo
Nexus_5X_API_28_x86
Nexus_7_API_28
f:\android\sdk\emulator>emulator @Nexus_5X_API_28_x86 -netfast

The final command will start your emulator in a moment. At the end the option ‘-netfast‘ disable network throttling or the long format is “-netspeed full -netdelay none”

The rest of the option details and more can be found at official android developers page from the following link:

https://developer.android.com/studio/run/emulator-commandline