Holla 🤠 my Friend, let me first introduce myself my name Jyotirmoy barman a tech nerd from the west part of India 🇮🇳 (Meghalaya). In this article, I am going to tell about git and how to install it in termux, as I know many beginners may be using the phone to do some light development or don't have money to buy a laptop.
Do follow me on Twitter to get all the latest updates @jyotirmoydotdev
As the internet says git is a version control to track the code changes and there is not any second thought. I am not going to explain it in detail, If you want to read more about it you can go to Wikipedia.
Installation of Termux on a phone is simple, just follow these steps.
If you want to install git on your phone then you must install the termux app first. As the termux app updated version is not available in play you must use the third party website to install it.
There are two places from where we can download the latest version of Termux.
After you have successfully installed termux on your phone, now you need to run some commands to update the packages and install git.
First, update the packages, this will update all the packages in Termux
pkg update && pkg upgrade
Run this command to install git in termux
pkg install git
I also recommend to install
gh, it is a command line tool by github.
pkg install gh
Recently Github announced that it will no longer accept account passwords when authenticating Git operations, that's why we need gh (Github command-line tool) to push our code in Github.
What is Github?
Github is a code hosting platform, owned by Microsoft.
For more information visit Github-wikipedia
Follow me on Github @jyotirmoydotdev
Till now you must install git and gh in termux, now it's time to learn it. First of all, we need to set up our git and gh to work flawlessly
write the following command to set up.
gh auth loginLogin to your Github account.
- After you log in to your Github account, now setup your git
git config --global user.name "name"
git config --global user.email "email"
- Now you are all set
If you want to track a folder you need need to init a folder. I recommended you first go to your Github account and make a repository.
After that clone it in your local environment
git clone "repository link"
run this code
gh create repo create and follow the command.
Push and Pull
After you have written some code in your repository and wish to upload it to your GitHub account then run this command.
git add .this will add all the code or if you want to upload a single file
git add "file name"
git commit -m "Message"write what you have done in "Message"
git pushthis will upload all the code.
If you have done any change in your repository from Github or any other local machine and push it to your repository, then you can run
this will pull all the latest code and keep you up-to-date.
Here are the commands and their action for git and gh.
|git --version||to see what version of git you are using|
|git clone||to clone the repository in the local environment|
|git add .||to add all the files|
|git commit -m “message”||to commit with message|
|git commit -m “title” -m “description”||to commit with message and description|
|git push||to push code to the origine|
|git pull||to pull the code from the online repo.|
|git config --global user.name "name"||to set the name|
|git config --global user.email "email"||to set email|
|git branch --list||to see what branch we have|
|git branch||to create branch|
|git branch -d||safe branch delete|
|git branch -D||Force delete|
|git branch -m||merge branch|
|git status||To see the changes|
|git switch||to change existing branch|
|git switch -c||to change to new branch|
|git log||Show commit logs|
|gh auth login||to login in Github|
|git auth logout||Log out of a GitHub host|
|git auth status||View authentication status|
|Install git||brew install git|
|Install gh||brew install gh|
Thanks for reading this far, don't forget to follow in Twitter - @jyotirmoydotdev and Github - @jyotirmoydotdev.
I am always open to your suggestion 😄 email@example.com
Top comments (0)