I'm building a ROM but I need a commit into /frameworks/base repo. So i "git fetch" the Github repo and then I type "git commit xxxxx", but the output is:
error: pathspec xxxxx did not match any file(s) known to git.
Any help?
You need to do these things in order..
Fetch All Branches
git fetch --all
Check Branch Name
git branch
Then Checkout to branch
git checkout your_branch_name
Now, while committing
Add all files you want to commit in the staging area
git add . (for all files)
git add filename (for respective file)
Commit to local database
git commit -m "your custom message"
Push to remote repo
git push origin current_branch_name
Here, origin is the remote name.
Try
git checkout -b yourbranchname
And then try again.
I think you should clarify some concepts of git before using.
1) 'git fetch' only update those refs to remote branches, it do not merge remote modifications to your worktree. You need run 'git pull' to merge with your worktree.
2) you need a branch to work on. You can run 'git checkout -b' to create a new one, or 'git checkout --track' to create one tracking remote branch.
Related
To cut the story short, to run a convolutional neural network model, I need an special version of nolearn, which has a url of the form https://github.com/dnouri/nolearn/tree/1659e4811e498dc1f442d8e6486d0831f85255b4/nolearn . However, there are no Download as Zip buttons at the page, nor I can download it with
git clone https://github.com/dnouri/nolearn -branch 1659e4811e498dc1f442d8e6486d0831f85255b4/nolearn
Simply,
git clone https://github.com/dnouri/nolearn/tree/1659e4811e498dc1f442d8e6486d0831f85255b4/nolearn
does not work, too.
Even, I have no idea what should I search for in Google!
Note: This is the last version which provided support for the class Objective, i.e. the command from lasagne.objectives import Objective is no more supported!
This can help you:
How to clone a single branch in git?
Where specifies:
git clone <url> --branch <branch> --single-branch [<folder>]
Docu :
Git Clone
--[no-]single-branch
Clone only the history leading to the tip of a single branch, either specified by the --branch option or the primary
branch remote’s HEAD points at. When creating a shallow clone with the
--depth option, this is the default, unless --no-single-branch is given to fetch the histories near the tips of all branches. Further
fetches into the resulting repository will only update the
remote-tracking branch for the branch this option was used for the
initial cloning. If the HEAD at the remote did not point at any branch
when --single-branch clone was made, no remote-tracking branch is
created.
Other than in Subversion (SVN), git has separate namespaces for directories (file system folders), branches and tags. Thus https://github.com/dnouri/nolearn/tree/1659e4811e498dc1f442d8e6486d0831f85255b4/nolearn is not, per se, a branch. 1659e4811e498dc1f442d8e6486d0831f85255b4 is a commit ID, used here to refer to the revision created by the commit. dnouri/nolearn is the repository name on GitHub (repository nolearn on account dnouri) and the final nolearn in the URL is a directory within the content of revision 1659e4811e498dc1f442d8e6486d0831f85255b4.
The 'normal' way to get this code with git would be:
replicate the repository to your local machine
git clone https://github.com/dnouri/nolearn.git
(You can find this URL on the repository's page https://github.com/dnouri/nolearn, in the 'clone URL' field.)
enter the local repository
cd nolearn
check out the wanted revision
git checkout 1659e4811e498dc1f442d8e6486d0831f85255b4
change into the respective directory inside the repository
cd nolearn
This is the link to the .zip : https://github.com/dnouri/nolearn/archive/1659e4811e498dc1f442d8e6486d0831f85255b4.zip
I have only one commit on master and haven't merged it into the remote. I want to remove my commit, keep my changed files, change my branch, and commit them.
Now I have used git reset --soft HEAD~1, but I am faced with this error:
fatal: ambiguous argument 'HEAD~1': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'
HEAD~1 is a way to point at "the parent of current commit"
In your situation: the (only) commit on master does not have a parent ...
If your intention is to have this commit on another branch, simply create that other branch:
git checkout -b my/branch
# The above is a shortcut to:
git branch my/branch # Create a new branch `my/branch` on the current commit
git checkout my/branch # Switch to this branch
With one single commit in its history, "removing the commit from master" is the same as "deleting master".
There is no harm in doing it (you can re-create it later): git branch -d master, but you can also live with a local master branch hanging around.
An alternative is to amend the first commit:
# Make your change in the file(s)
git add file_changes
git commit --amend --no-edit
Resource: How can I add a file to the last commit in Git?
If this is from flutter, then the problem is simply from your installation process.
check your .git > refs , if the heads & remote directories are empty, then you simply have incomplete files.
Delete your current flutter folder and download again.
Ensure that 100% of the files are moved/copied during extraction
I just commited 2 changes in /frameworks/base, but when I type repo sync -f -j5 at the end of the sync the changes are gone and it says
Fetching projects: 100% (494/494), done.
Syncing work tree: 100% (494/494), done.
frameworks/base/: discarding 2 commits
In frameworks/base I just did git fetch /repo/project, git cherry-pick xxxxx and git commit. Nothing else.
Any help would be appreciated :)
repo sync -f will convert to a detached header status.
you can enter /frameworks/base, use command git branch -a to find the branch you just commit in. and git checkout to switch to it.
I'm new to git. I want to create a new project with Eclipse, and use Github to manage it.
The problem is, Github suggested me to add a .gitignore file to let it ignore files in bin, but once I did that, there is a new master in the Github's repository.
Then when I tried to push my project, it said:
To git#github.com:Benjaminz/SocialEventPlanner
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git#github.com:Benjaminz/SocialEventPlanner'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
When I ran pull it said:
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
What mistake did I make? How to correct this?
Thank you. :)
it seems that ur poject is not stashed
Do Below Steps :
git stash
git pull
git stash pop
For the second error message, you can type:
git branch -u origin/master master
Then try again your git pull.
I'm playing with the Android source code and I would like to switch to 2.3.3 and make some modifications from there. How do I do this?
More specifically, I made a git clone of the Launcher2 project and would like to switch it to the android-2.3.3_r1a tag. I tried,
git checkout android-2.3.3_r1a
but Git seems to think I'm trying to make a new branch instead.
I also tried
git branch -r
which listed
origin/HEAD -> origin/master
origin/eclair
origin/eclair-passion-release
origin/eclair-release
origin/eclair-sholes-release
origin/eclair-sholes-release2
origin/froyo
origin/froyo-plus-aosp
origin/froyo-release
origin/gingerbread
origin/gingerbread-release
origin/master
origin/tools_r7
origin/tools_r8
origin/tools_r9
and then
git checkout origin/froyo
but nothing seems to happen (files are unchanged) and
git branch
still outputs "* (no branch)".
all you need to do is git checkout -t origin/android-2.3.3_r1a. This will give you the branch you want and track the remote one.
Try:
git checkout -b android-2.3.3_r1a origin/android-2.3.3_r1a
Or:
git branch android-2.3.3_r1a origin/android-2.3.3_r1a
git checkout android-2.3.3_r1a