Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6654519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:23:59+00:00 2026-05-26T01:23:59+00:00

Say, I have my git repo (the .git folder) located in ~/my_project/ . Assume

  • 0

Say, I have my git repo (the .git folder) located in ~/my_project/. Assume also that my project’s folder is assembled like that:

my_project
      |
      |____src
            |
            |__com
            |
            |__org

Last of all, assume that I’d like to stage the com folder for commit. I may do it in at least two ways:

  • albus@hogwarts:~/my_project$ git add src/com
  • albus@hogwarts:~/my_project/src$ git add com

Would there be any difference between the two invocations? What about git format-patch or git am? Do they depend on the current path?

People may laught at my question, but truth is, a colleague of mine said that they had trouble applying some patches, i.e. they had to apply them from different directories in the project path. They also recommended that I should do all git commands from the upmost project folder (i.e. my_project in this example). I never though there might be truth in this, but I’m not an expert where git comes into the picture and therefore I’m asking it here.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:24:00+00:00Added an answer on May 26, 2026 at 1:24 am

    git format-patch creates the same patch wherever you ran the command. Only thing that changes is where the patch file is generated.

    But different commands behave differently, which also depends on flags applied to them.

    For example, git diff has the --relative flag:

    –relative[=<path>]

    When run from a subdirectory of the project, it can be told to exclude changes outside the directory and show pathnames relative to
    it with this option. When you are not in a subdirectory (e.g. in a
    bare repository), you can name which subdirectory to make the output
    relative to by giving a as an argument.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I've got a project under git version control. Within that project, I have
I have a a remote git repo and a local clone. Let's say I
Say I have this type of structure: Project/Code files : C:\myCode Git Repository :
say i have a git repo, with such commit history: A-B-C-D-E Now, suddenly i
We have a new git repo that is acrued from a svn repo. The
If I have a Git repo on a directory say /app1 is it possible
If I have an npm dependency that is nested in a git repo, how
I have a repository, say abc/myprject.git . I have this repo on a server
So, I have a project that was originally under git version control, The project
Let's say I have a repo called stuff. git@github.com:mine/stuff.git when I do a git

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.