How to create a symbolic link across git branches?
Asked Answered
M

1

7

I am working on the SO Ruby Chat rules repo. The RULES.md in master should be the same as rules.md on the gh-pages branch; however, it does not reflect changes of the latter.

I know that a symbolic link in Directory B simply points to a file in Directory A. I want to apply the same logic across branches in git.

Again, since the gh-pages branch is the main focus, I would like a symlink in master that points to gh-pages/rules.md. I have done some research and cannot find anything for this exact issue.

Message answered 15/8, 2015 at 1:27 Comment(1)
I've fixed the duplication that this question wishes to address, but in a different way. The redundant copy of the rules, RULES.md in the master branch has been removed. The question is still valid, however.Landing
V
3

The scenario you are trying to implement is not possible(sym link).

Please check the following things if you are worked or not.

  1. Modified the rules.md file in master/any other branch.
  2. Check the status using git status
  3. Add rules.md file using git add rules.md
  4. Commit your changes in git using git commit -m "message against the changes"
  5. Once this is done you want your changes to be reflect in other branches also.
  6. Move to your branch using git checkout branchname
  7. And now merge the changes that you did in master.
  8. For merging use git merge branch name

If there are no conflicts then it should merge smoothly. All your changes present in master branch reflects here.

Vinny answered 15/8, 2015 at 3:42 Comment(2)
I am marking this as the accepted answer. Your method results in more commits than I would like, but your first sentence is the real answer. I appreciate your advice. Do you know if a repo with a gh-pages branch can survive with the master branch removed? Where gh-pages becomes the new master?Message
Yes, one and only gh-pages branch is a possibility. That is what I've done for my blog. It can be accomplished through GitHub web interface ─ all you need to do is check gh-pages branch as the primary one and then remove the master branch.Waistcoat

© 2022 - 2024 — McMap. All rights reserved.