git add image is not pushed to server - android

I changed a drawable a png file after I edited with GIMP and added to Android Studio in res folder. On the emulator i can see it is changed. And i can see on bitbucket that is not changed although i send these commands
git add -A #I tried also git add -u and git add .
git commit -m "new button"
git push -u origin master
my git status says that everything is updated. I understand that the way git works does not detect that i changed the file. I remember i did it something in few months ago without using rm but I cannot remember which command I used

Try the --refresh and --force flags.
From the Git manual:
--refresh
Don’t add the file(s), but only refresh their stat() information in the index.
-f, --force
Allow adding otherwise ignored files.

Can confirm in my experience that changing the name of my image on my local site and then adding and pushing the changes to Git caused the image to then show up on git's live page servers.
Thanks for the tip #trocchietto!

I found a workaround, but I would not be happy to mark as answer. Just changed the name of the file, refactored the name, and added, committed and successfully pushed.
It works, but is not the command I launched few months ago

Related

How to clone clarifai-android-sdk using "git lfs"?

I want to create an object detection application using clarifai android library found in the following link:
clarifai android
The documentation is very clear but the problem is in cloning the clarifai-android-sdk using git-lfs
and this what is mentioned in the documentation:
1) Git LFS
Before doing anything else, please make sure you have Git-LFS
installed on your system. The binary contained in the framework is
managed by GitHub using git-lfs.
If you don't have it installed yet, you can find details at:
https://git-lfs.github.com. IF YOU DON'T HAVE GIT-LFS INSTALLED, THE
SDK WILL NOT WORK.
2) Verifying the SDK
After setting up Git LFS, please ensure that the SDK
cloned correctly, by checking the size of the *.aar. If the size is
less than ~120MB, then you will need to re-pull master now that Git
LFS is set up.
If you downloaded a ZIP of the project via the "Clone or download"
button, the SDK will be cloned incorrectly. Either clone the repo with
git, or download the *.aar file specifically by clicking on the file
through GitHub, and clicking the "Download" button.
if it is not clear this is a link of the full clarifai-android-sdk documentation
I have already installed git-lfs but when I try to clone the repository of clarifai-android-sdk the size of '.aar' file is 100 megabyte not as mentioned previously that:
if the '*.aar' file is less than 120 megabyte then you will need to
re-pull master now that Git LFS is set up.
so generally: I need to know what should I do to solve this problem ?
and specifically what is the meaning of re-pull master now that Git LFS is set up.
I would think that doing a git pull would solve that (yeah its unusual to do it right after a git clone but that seems to be what it is saying.

Git status head detached after git reset --hard

So I'm fairly new to git, but I have basic knowledge of how it operates and I have been playing around with the Android source recently (more specifically LineageOS, but it doesn't really matter for my question).
Basically, I followed the Android and Lineage guides to setting up a build environment with Linux (Xubuntu 16.04 LTS), downloaded the source, got my phone's proprietary blobs and successfully built it. Next I began cherry-picking some features.
According to the Google documentation for AOSP, I should move to a project folder and do a "repo start BRANCH_NAME ." to create a topic branch, then make my changes, git add them and commit them. The thing is, I don't want to push these changes to anywhere. I am simply wanting to work locally, only pulling new changes while keeping my cherry picks. So I did a bunch of cherry picks and ran a build again, which was successful but one of the things I cherry picked is causing me an issue and I want to completely revert it.
I first did repo sync and moved to a project folder, when I did "git branch", it returned "* (no branch)" in green, and when I did "git status", it told me that I'm not currently on a branch and that the working directory is clean.
Now, since I created a topic branch in one of these projects and cherry picked a couple commits, git status tells me I am 2 commit aheads, so to remove them, I did "git reset --hard github/cm-14.1", which completed and I verified that the files were reverted back to their original state. I ran "repo prune" to get rid of the now unneeded topic branch, and when I run "git branch" again, it says "* (HEAD detached at 12f0903)" in green and when I run run "git status" it also says HEAD is detached at 12f0903 in red, but also tells me that there is nothing to commit and that my working directory is clean.
Finally, after all of that, if I just create a new branch now, status and branch return clean, normal output with no detached head message. Is there a way to get back to the very beginning state of not being in a branch and not having a detached head or am I totally confused and doing something wrong?
Is there a way to get back to the very beginning state of not being in a branch and not having a detached head
Simply checkout the SHA1 referenced by your current branch:
git checkout $(git rev-parse HEAD)
As already stated, being in a detached HEAD mode is not a big deal, unless you want to add new commit (in which case, creating a dedicated branch that you would push to a fork is a good idea)
The Android Lineage guide mention the command
repo init -u https://github.com/LineageOS/android.git -b cm-14.1
That means you can go back to the local branch cm-14.1 with
git reset --hard cm-14.1

Contribute on GitHub using Android Studio

I'm not new to using GitHub on Android Studio, but:
This is my first try to contribute to a sample project for Android on GitHub.
I did the following
I cloned the repository:
I made my changes
I committed my changes
I pushed my commit
And baam (here is the problem):
Why? What things did I miss?
(Don't forget, I have never contributed on GitHub, and this is my first time.)
403 indicates that you are not allowed to access the resource - you aren't authenticated with GitHub. To fix this, you should change your remote URL to a repository you have access to, then push your changes:
https://myusername#github.com/user/repo.git
From the command line you would need to do the following (Android Studio should automatically detect the changes):
git remote remove origin
git remote add origin https://myusername#github.com/user/repo.git
git push -u origin --all // prompts for authentication, pushes your changes to github
Your question has nothing to do with Android Studio, I guess if you try to push your changes through command line you'll get the same result. Read about Contributing to Open Source on GitHub.
First of all, to do a contribution:
You must fork the repository
Clone your fork version of that repository
Through the command line, navigate to your clone directory then add upstream version (original repository):
$ git remote add upstream https://github.com/fcannizzaro/material-stepper.git
You can check it using the line $ git remote, and you will see origin and upstream.
Make changes → commit them → then push (all of this happen on your repository (forked one), not the upstream).
Go and check the network graph for both the forked and original repositories.
Go to the GitHub original repository's link and click pull request.
Do as described in this image:
And fill the others field and click Create pull request
Thanks for Erik Carlsten's tutorials.

Phonegap won't pull latest version

I'm making some changes to a test app to see how it works, git + phonegap, and for some reason I dont think phonegap is pulling the latest code. I can see the changes on github, here's the public test: https://github.com/xxAndreixx/prueba
I'm making the changes to the index.html file in the www folder, and I'm trying to install the app after I pull the code and rebuild, on an Android phone and however I can't see the changes when running the app; idk if I'm running the wrong commands on git. What I do is: 1) git commit -m "msg" 2) git push -u master origin
IDK where I'm failing.
#Andrei,
are you pressing the [Update Code] button?
TIL: don't be stupid and follow the correct order while in the ROOT.

how to use "repo" to clone minimal android source?

I am able to clone the Android source code by using the "repo" tool. However, what I want to do is clone the source code in a more minimal way than having an 11GB footprint. It seems to download things related to every Android device and every prior release. I tried thought I could reduce this by checking out a specific branch like this:
repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
However, what ends up happening is that I still get everything involved, just at a specific snapshot (understandable). But is there any way to limit the amount that is cloned?
The android source tree is made up of many separate git repositories, which are all managed by repo. You can't really reduce the amount of data that's downloaded for a given git repository.
However, you can only download a subset of the git repos that are available, using repo sync <project>. I.e. if you only wanted the frameworks/base package, you should be able to do repo sync frameworks/base, after doing the initial repo init.
If you are actually wanting to build the source though, you probably want the full thing.
You might be able to save a gig or two by removing the device repositories that you don't need. You can do this by editing <source>/.repo/manifest.xml and removing the repositories for the devices you don't want.
There are a number of things you can do. First, "repo sync" with a -c argument will limit the checked-out sandbox to only the "current" branch. The repo sync will not download material for other branches.
You can also edit the .repo/manifests/default.xml manifest. What I do is make a backup of it such as "default.bak" and then strip out the lines from the default.xml file I know I don't need. Because I'm not building on a Macintosh, I know I don't need any of the "darwin" tools, so I remove every line that contains "darwin". Then "repo sync" doesn't download any darwin projects or install the source code in the sandbox.
If you already synched a sandbox, and you want to trim its size, you can strip projects out as above, and then do "repo sync -c -l", and repo sync will only strip the directories that you just removed. The -l flag only does the local part of the sync, which means it only syncs the local git projects with your source tree. The network is not used. See the "-n" flag for the other half of a normal sync, which does the network sync to update the local git projects with the upstream repository.
To also remove the git backing object stores for the unwanted projects (which take up a lot of room) I use this:
for project in `diff ~/android/.repo/manifests/default.xml ~/android/.repo/manifests/default.bak | awk '{print $3}' | grep path | cut -f2 -d\"`; do rm -rf ~/android/.repo/projects/$project.git ; rm -rf ~/android/.repo/project-objects/$project.git ; done
This finds all the projects that are in your backup manifest, but have been removed from your active manifest, and removes the git projects and all the backing data for them. This recovers a lot of space.
If you remove too much, just recover the project line from your backup manifest, and add it back into your active manifest. Then, a repo sync will get your git projects and your sandbox straight again. You can test the build to see if you've removed too much by doing "mma -B -n" in your project directory. This will try to do a full dependency build on your target, forcing all the targets to build even if they don't need it, and it will do it as a dry run. If the build fails, you removed something your project needs.
You can also set up a local mirror sandbox, and create small, working, reference sandboxes from your mirror. The working sandboxes don't contain git object stores, but refer to the central ones in the mirror. Use "repo init -u ... --mirror" to set up the mirror, and "repo init --reference=~/android-mirror -u ..." to refer to the mirror. The -u flag in the latter allows a real upstream repository to be used as the authority, while the mirror reference is used as a local cache. Local mirrors also avoid the download quota that the AOSP project enforces, and they are faster to sync to.

Categories

Resources