Ignore Git commit during Git p4 submit
Asked Answered
R

2

6

I have a Git repository inited from "git p4 clone" command, and its folder structure is as below:

.git
folder A
folder B
fileA
fileB

Folder A and folder B are cloned from Perforce with "git p4 clone" command, and fileA and fileB are added to Git after clone.

Not I would like to use "git p4 submit" to sync Git commits to Perforce, and the problem appears. Since fileA and fileB are not from Perforce and there is no view mapping for the root folder in P4 client view configuration, the attempt to apply the patch which creating these two files in Git always fails: error: fileA: already exists in working directory error: fileB: already exists in working directory

Even bad that the commit is the first one I made in Git repository, now each time I try to run "git p4 submit", it starts from this unsubmittable commit and tries every commit after it. I tried to add these two files to .git/info/exclude but no help.

So my question is: is there any way to tell "git p4 submit" ignoring some files, or ignoring specific git commit? Thanks in advance.

Relativistic answered 4/12, 2013 at 5:51 Comment(0)
I
1

One way to get the already exists in working directory error from git-p4 is if you're trying to submit a patch that adds a file which is already in the local perforce directory.

In my case I just needed to clean my local perforce directory and remove the files indicated in the error message (making sure not to delete anything I wanted of course).

Iphlgenia answered 13/2, 2021 at 0:22 Comment(0)
W
0

You can use --origin <commit> with "git p4 submit".

--origin <commit>

Upstream location from which commits are identified to submit to p4. By default, this is the most recent p4 commit reachable from HEAD.

By using this you can choose the commits for submission. For more options:official documentation

Woods answered 18/4, 2015 at 7:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.