Post APseAFKFsx3Zygf2iu by steve@mastodon.tech
 (DIR) More posts by steve@mastodon.tech
 (DIR) Post #APscs1jnZC1cfWMCyO by AIaYYAle4i1uKmKpqy.gme@bofh.social
       2022-11-23T01:35:12.800607Z
       
       0 likes, 0 repeats
       
       Ugh!I’m not a software developer so I barely know how to use git (and I freely admit this). But I’ve run into a snag that I’m sure is very simple but I’ll be damned if this is not driving me insane.I’ve made some local changes to a file in a project.I’ve added both the relative path, the absolute path, and just the name of the file I’ve modified to the .gitignore file in the project directory.I was under the impression that the .gitignore file basically told git to not fetch/ overwrite that file. To “ignore” it so to speak.But I just tried to do a git pull to update the files and git is spitting this out at me:error: Your local changes to the following files would be overwritten by merge:        resources/tpl/site/access.master.tpl.phpPlease commit your changes or stash them before you merge.AbortingHow am I supposed to commit changes when I haven’t done a pull request and aren’t really looking to commit my changes upstream?
       
 (DIR) Post #APsdPtbEKYxFH4V1Ae by BlueBassist@social.horrorhub.club
       2022-11-23T01:39:41Z
       
       1 likes, 0 repeats
       
       @gme I could be misremembering, but I think you have to commit your changes to .gitignore in order for it to work? So .gitignore is for repo-wide file exclusions. You want .git/info/exclude
       
 (DIR) Post #APsdPu6mRGBwqvGDLc by AIaYYAle4i1uKmKpqy.gme@bofh.social
       2022-11-23T01:41:18.374475Z
       
       0 likes, 0 repeats
       
       Ah! There is a .git/info/exclude file. Let me try that, thank you!
       
 (DIR) Post #APsdZWlU5GsrLkt8XQ by AIaYYAle4i1uKmKpqy.gme@bofh.social
       2022-11-23T01:43:03.525841Z
       
       0 likes, 0 repeats
       
       Nope. Didn't work.
       
 (DIR) Post #APsdlYUFVWMEAKYuFE by steve@mastodon.tech
       2022-11-23T01:42:29.728706Z
       
       1 likes, 0 repeats
       
       @gme You can `git stash` to temporarily store the changes and then `git stash pop` to restore them after the pull.
       
 (DIR) Post #APsdlZ1vUJIPqmJnjk by AIaYYAle4i1uKmKpqy.gme@bofh.social
       2022-11-23T01:45:13.468048Z
       
       0 likes, 0 repeats
       
       Well I tried that and it told me there was a merge conflict and my changes are now gone. 😨
       
 (DIR) Post #APseAFKFsx3Zygf2iu by steve@mastodon.tech
       2022-11-23T01:48:42.703732Z
       
       1 likes, 0 repeats
       
       @gme A merge conflict when you did 'git stash pop'? That *will* do a merge of your previous changes into the updated workspace after the pull. If there's a conflict, you'll need to resolve it, but you shouldn't have lost anything. You can also do 'git stash list' to see if you have anything still stashed.
       
 (DIR) Post #APseAG1VI9eS8ota8O by AIaYYAle4i1uKmKpqy.gme@bofh.social
       2022-11-23T01:49:40.244799Z
       
       0 likes, 0 repeats
       
       git stash list says something about "merge pull request".
       
 (DIR) Post #APseBAPtceRB2gjqvg by jerry@shouldagoneoffroad.com
       2022-11-23T01:49:25Z
       
       1 likes, 0 repeats
       
       @gme '.gitignore' is intended to tell git not to suggest that you add/commit/push certain files. For example, my editor likes to create these dumb little settings files and put them in the same folder as my project. I add those to '.gitignore' so that git doesn't constantly suggest I add them (or add by default when I just run 'git add'). You seem to want to use '.gitignore' to temporarily ignore changes to a file you're working on... more on that in another reply...
       
 (DIR) Post #APseBYTcATfjfAfA3c by jerry@shouldagoneoffroad.com
       2022-11-23T01:47:45Z
       
       1 likes, 0 repeats
       
       @gme Hard to give you the info you need in 500 characters. Strap in for multiple replies...
       
 (DIR) Post #APseDwapTVNl2PB0qm by BlueBassist@social.horrorhub.club
       2022-11-23T01:50:05Z
       
       1 likes, 0 repeats
       
       @gme Looks like you might have to do `git update-index --assume-unchanged <path-to-ignored-file>` after you modify it.
       
 (DIR) Post #APseKUaVzmMwD09UjA by AIaYYAle4i1uKmKpqy.gme@bofh.social
       2022-11-23T01:51:32.886076Z
       
       0 likes, 0 repeats
       
       "fatal unable to mark file"
       
 (DIR) Post #APseQWZjWFy46sf9Qu by BlueBassist@social.horrorhub.club
       2022-11-23T01:52:12Z
       
       1 likes, 0 repeats
       
       @gme I see elsewhere in the thread that you encountered a conflict when you popped your stash. Has that conflict been resolved?
       
 (DIR) Post #APseQX2nmBDhZ2GMk4 by AIaYYAle4i1uKmKpqy.gme@bofh.social
       2022-11-23T01:52:37.386733Z
       
       0 likes, 0 repeats
       
       How do I tell?
       
 (DIR) Post #APsek8a8R6obUGCdsm by BlueBassist@social.horrorhub.club
       2022-11-23T01:53:26Z
       
       1 likes, 0 repeats
       
       @gme Do a git status. It should tell you if there are unresolved conflicts.
       
 (DIR) Post #APsek98sLwbXE0SO24 by AIaYYAle4i1uKmKpqy.gme@bofh.social
       2022-11-23T01:56:08.492147Z
       
       0 likes, 0 repeats
       
       I see my modified file under unmerged paths and it says do a git add to mark resolution.So should I just do a git add and specify the file I modified here?There's also two files listed under untracked files that I did NOT modify. But I assume since that says untracked files those are okay?
       
 (DIR) Post #APselsN5g2YJn4vkXo by jerry@shouldagoneoffroad.com
       2022-11-23T01:54:06Z
       
       1 likes, 0 repeats
       
       @gme Someone made changes to the same file you've made uncommited changes to. Git's trying to watch your back and not allow the pull to proceed. You have four options:1. Revert your changes: 'git checkout -- resources/tpl/site/access.master.tpl/php'2. Use 'git stash' to scoop up all your changes to the entire project. Use 'git stash pop' to get them back after 'git pull' is done. You might have to merge.3. Commit your changes locally and then merge after 'git pull' is done.
       
 (DIR) Post #APsem6lMAcHWQOOKJM by jerry@shouldagoneoffroad.com
       2022-11-23T01:55:05Z
       
       1 likes, 0 repeats
       
       @gme Merging is kind of a pain in the butt, but it usually means you manually go through the file in question and decide if you want your code or someone else's code in the file (or both). Explaining this in 500 chars isn't really possible -- if you have a mentor - this would be a great question for them.
       
 (DIR) Post #APsemXXScOD1T766ts by jerry@shouldagoneoffroad.com
       2022-11-23T01:55:49Z
       
       1 likes, 0 repeats
       
       @gme Version control is pretty handy, but it can get complicated really fast. I hope you get this figured out and that this info was helpful. Good luck!
       
 (DIR) Post #APsenCjFTT03DXvbSy by AIaYYAle4i1uKmKpqy.gme@bofh.social
       2022-11-23T01:56:44.707007Z
       
       0 likes, 0 repeats
       
       Thank you!
       
 (DIR) Post #APsf0FoBKsdiX7SSyO by BlueBassist@social.horrorhub.club
       2022-11-23T01:58:39Z
       
       1 likes, 0 repeats
       
       @gme Yeah, you can safely ignore untracked files. If you had your file that you're trying to exclude open in an IDE when the conflict happened, you should be able to ctrl+z to the state it was before. Your locally modified version. Otherwise, you will have to open the file and there's notation that's been added indicating the conflict lines. You'll have to clear those lines to get it to the way you want, then you can git add the file to resolve the conflict. THEN go back to the update-index lol
       
 (DIR) Post #APsgnUZRL3vMSeba2S by chrmi@tech.lgbt
       2022-11-23T02:16:31Z
       
       1 likes, 0 repeats
       
       @gme if you add a file to a stage (git add), then change the gitignore, you still have to remove the file from the stage, gitignore is just a hack to exclude on add. TL;DR ‘git rm -f [filename]’ then git add should ignore it next time
       
 (DIR) Post #APsgoLiTkBe7I2F2zA by AIaYYAle4i1uKmKpqy.gme@bofh.social
       2022-11-23T02:19:21.749917Z
       
       0 likes, 0 repeats
       
       Thank you for the suggestion!
       
 (DIR) Post #APsjsvzj6WIqpFBfLE by chrmi@tech.lgbt
       2022-11-23T02:21:19Z
       
       1 likes, 0 repeats
       
       @gme that may not address the actual problem you were trying to solve, but it’s a common gitignore problem none the less :)
       
 (DIR) Post #APtaoqP3FLcxtby2ds by iwein@mas.to
       2022-11-23T06:27:48Z
       
       1 likes, 0 repeats
       
       @gme .gitignore is not intended for files that are already under version control, i think. Afair having an upstream sample and ignoring local changes cannot be done conveniently with the same filename.
       
 (DIR) Post #APtarNWb4VwxCThmhU by alexstandiford@fosstodon.org
       2022-11-23T03:36:00Z
       
       1 likes, 0 repeats
       
       @gmeI think you need to stash your changes, pull from the remote, apply the stash, and resolve any conflicts. git stashgit pullgit stash apply