git is unrecongised even I have installed it on my machine - android

In this tutorial they said:
To Clone volley you need to install Git GUI Client from (
http://git-scm.com/download ), I have installed Git GUI Client on my
windows machine After Installing Set the environment variable . After
Installing Git type the following below command line in your command
prompt.
git clone https://android.googlesource.com/platform/frameworks/volley
I have installed the gui git , and when I run the command I get git is unreconginised.
if I go to gui and and push to https://android.googlesource.com/platform/frameworks/volley they asked for username and password.
all I want is to clone volley and start using in my app. how to do that ?

Installing the git GUI vs installing git on the command line are different things.
When you download git, it should come with an application called git bash that looks like this
For Windows, you have to open this application which will come out with a terminal window of its own where you can perform git commands.
Keep in mind it has some basic things similar for navigation like in Linux (you can still use cd to navigate and wherever you do git clone, it will make the repo in that folder.
If you want to run git commands from command prompt, you need to check the option while installing i.e.
You can check if it's working on Command Prompt by typing git and you should see options come up.

Related

android studio commit changes on Team services/tfs

I am using Team foundation services to upload android studio projects on TFS server
I the project is added successfully to server using
VSC -> Import into version control -> Import into Team services git
But when i tried to change any code in the activity and click VSC -> Commit changes a pop up message return no changes detected why??
Please try below items to narrow down the issue:
Try to run command $ git status (You need to install Git bash to run the command under the repo) to check if there are any error
messages there. If get the error like this : bad index file sha1 signature, fatal: index file corrupt. Just try to delete the index
file, then reset with below command (Reference this thread :How to resolve "Error: bad index – Fatal: index file corrupt" when using Git):
del .git\index
git reset
To run the command : Install Git bash >> go to the git repository and right-click the project folder >> Git bash here >> Run the command in Git bash.
Go to the file you have changed and Right Click >
Synchronize, then it will check against the last one manually. The commit again.
For Android studio with Git, you can reference Version Control System using Git on Android Studio.
I uninstall the Git and re install it again also i started from zero to upload the projects and commit works fine

How to move Android source code files synced on Windows machine with Cygwin to PC running Ubuntu 14.04

Firstly, I got two questions to ask. My first question is I've downloaded repo tool for Windows and within Cygwin terminal used the below command
repo init -u https://github.com/CyanogenMod/android.git -b cm-14.0 --depth=1
to get CyanogenMod android source files and later used the below command
repo sync .
Now I want to move my local repository and source files to another machine that runs on Ubuntu 14.04. How to achieve this? Does a simple simply copying of files will make the repo work on Ubuntu? I have very limited bandwidth for PC running ubuntu so I don't prefer to download the entire files again in Ubuntu.
Now my second question is, there is new branch cm-14.1 so how do I update my local branch on Ubuntu after moving the files?
Thanks a lot in advance.
(Before all, you should fetch all branches to local machine, this is steps-by-steps tutorial: https://stackoverflow.com/a/40318872/3728901)
Use git bundle (for backup all branches)
A real example: On Windows OS PC
git clone --mirror https://github.com/donhuvy/personal_finance.git
cd personal_finance.git/
git bundle create repo.bundle --all
repo.bundle is the file what you need (full back up) in the same directory.
How to restore from file repo.bundle (On Ubuntu OS PC):
git clone repo.bundle
Reference
https://git-scm.com/docs/git-bundle
http://rypress.com/tutorials/git/tips-and-tricks#bundle-the-repository

Terminal & Git on Android Mobile

This is not a duplicate question as my previous question is deleted.
I use terminal to run my Python and MongoDB codes and willing to use Git to do push/pull my codes into a remote repository. Just wanted to know if I can install a real working terminal in my Android Lolly Pop Phone which will allow me to install Git using...
$ sudo apt-get install git
Type command. If it is not possible then can anyone tell me whether I can use Git on my Android phone via terminal in any way?
You can use termux on android.
Follow the procedures:
$ apt update
$ apt upgrade
$ pkg install git
$ git clone <repository address >
To set up storage:
$ termux-setup-storage
You'd be best off just using one of the several apps on the market, SGit was the first that came up for me in a search.
I don't expect you'd have much luck trying to use git directly in a terminal emulator.

Cherry pick from local source

I am new to kernel building on android. I have a moto g. I used the cm source code and built a basic cm kernel. It booted. Now i want to cherrypick. I have cloned another repo. Now i want to cherry pick stuff into my kernel from that local source. I tried googling a lot but couldn't come up with a way. Can anyone help me?
Here I would like to share an idea to solve your problem.
Push the branch (where your stuff exists) from one repository to another where you want to cherry-pick your stuff.
For example, your stuff exists in kernel-1 repository on branch-1 branch and you want to cherry-pick your stuff into kernel-2 repository on branch-2 branch.
Go to kernel-1 repository.
$ cd $WORKSPACE/kernel-1
$ git checkout branch-1
$ git push $WORKSPACE/kernel-2 HEAD:refs/heads/branch-1
Now go to kernel-2 repository.
$ cd $WORKSPACE/kernel-2
And you will find branch-1 here. So you can cherry-pick your stuff.
I am assuming that you have two folder.
1. kernel (change will be cherry-picked into here)
2. optimus (change will be cherry-picked from here)
Go to optimus folder and craete a branch say, my-local-stuff from your stuff.
$ cd optimus
$ git checkout -b my-local-stuff <your stuff>
$ git push <absolute path of kernel folder> HEAD:refs/heads/my-local-stuff
Now go to kernel folder and you will find my-local-stuff branch.
$ cd kernel
$ git checkout my-local-stuff
$ git log
<you can see the commits which you have created into optimus folder>
Now cherry-pick the commit whatever you need into whichever branches.
Please let me know if more explanation is needed.

Automation of GIT repo sync, get older commit versions, verify version

I'm very new at GIT, apologize if this is a basic question however I couldn't seem to find a similar situation after searching google and stackoverflow. Here's my scenario:
I have a git folder with the latest commit version that I do NOT perform any commit (I won't do any changes in the code in my local directory). Other people performs the commit on their computer, I just need to get a specific commit version, copy it to a working directory and build code. I'm planning to make a program to automatically perform these steps in repeated cycle everyday. Steps summarized below:
Get the latest commit in repo_folder
Go back to old commit version
Copy to a work_folder
Then build code in work_folder
I'm not sure if these steps are the correct/best way to do it. Also, how can I perform #2 correctly and how to make sure my program have retrieved the correct commit version? Is #3 necessary? Or can I just build code directly in repo_folder (might modify some files after build), then afterwards perform git command to get the latest commit version again?
Here's my steps actual steps
1. Get the latest commit in repo_folder
repo init -u ssh://username#git.aaa.com:1234/manifest.git -b branch -m file.xml
repo sync
After getting to the latest repo, I search through the logs and perform git reset --hard
2. Go back to old commit version
cd .repo/manifests
COMMITHASH=git log --grep=$keyword | head -1 | cut -d' ' -f2
git reset --hard $COMMITHASH
cp file.xml new_file.xml
repo init -m new_file.xml
After this command, I'm not sure how to check if my current version is correct.
Steps 3 and 4 just simple copy and build commands not related to this question.
cp -r repo_folder/folder1 work_folder/folder1
cp -r repo_folder/folder2 work_folder/folder2
run build.bat
Just clone your local master to a new directory and then checkout to the version that you currently need in that one:
No copying, no mucking about.
git clone -l /path/to/master /path/to/working
cd /path/to/working
git checkout -f REV_OR_BRANCH_ID
If you have any generated files such as objects it is a good idea to clean them up - such as with make clean after a checkout.
from then on you can:
cd /path/to/working
git pull
git checkout -f REV_OR_BRANCH_ID

Categories

Resources