How to add ~/.zshrc file into git? The 2019 Stack Overflow Developer Survey Results Are InHow to include directory tree for back-up using cpio?How did `git pull` eat my homework?Automounts: All mounting and will not umount on its ownPipe filelist into 'git add'Git Backup /home with other repos inside itRecursive move (`mv -rn`, like `cp -rn`), a move that will only move not present filesHow to install custom source from git using my package manager in Gentoo?How to make clean commits with etckeeper?extract tar archive to existing directory in git-bashexcluding huge files when using git tracking of dot-files
What did it mean to "align" a radio?
Is there any way to tell whether the shot is going to hit you or not?
The difference between dialogue marks
What does Linus Torvalds mean when he says that Git "never ever" tracks a file?
What is the accessibility of a package's `Private` context variables?
Does a dangling wire really electrocute me if I'm standing in water?
Is there a symbol for a right arrow with a square in the middle?
Who coined the term "madman theory"?
Why can Shazam fly?
Can someone be penalized for an "unlawful" act if no penalty is specified?
Pokemon Turn Based battle (Python)
How technical should a Scrum Master be to effectively remove impediments?
Identify boardgame from Big movie
What does "fetching by region is not available for SAM files" means?
Return to UK after being refused entry years previously
What is the meaning of Triage in Cybersec world?
What is the meaning of the verb "bear" in this context?
One word riddle: Vowel in the middle
Geography at the pixel level
What is the closest word meaning "respect for time / mindful"
What is the most effective way of iterating a std::vector and why?
Loose spokes after only a few rides
Why isn't the circumferential light around the M87 black hole's event horizon symmetric?
How to type this arrow in math mode?
How to add ~/.zshrc file into git?
The 2019 Stack Overflow Developer Survey Results Are InHow to include directory tree for back-up using cpio?How did `git pull` eat my homework?Automounts: All mounting and will not umount on its ownPipe filelist into 'git add'Git Backup /home with other repos inside itRecursive move (`mv -rn`, like `cp -rn`), a move that will only move not present filesHow to install custom source from git using my package manager in Gentoo?How to make clean commits with etckeeper?extract tar archive to existing directory in git-bashexcluding huge files when using git tracking of dot-files
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I would like to create a backup of the .zshrc file in my ~/ directory and avoid versioning all other items. How to exclude all subdirectories and their content?
For example:
cd ~/subdirectory/ && git status
should output:
fatal: Not a git repository (or any parent up to mount point /)
How to achieve this?
zsh backup git
add a comment |
I would like to create a backup of the .zshrc file in my ~/ directory and avoid versioning all other items. How to exclude all subdirectories and their content?
For example:
cd ~/subdirectory/ && git status
should output:
fatal: Not a git repository (or any parent up to mount point /)
How to achieve this?
zsh backup git
3
I link my dot files (ln -s ~/src/dot-files/zshrc ~/.zshrc). The VCS is used in ~/src/dot-files.
– Christopher
Feb 1 at 19:17
add a comment |
I would like to create a backup of the .zshrc file in my ~/ directory and avoid versioning all other items. How to exclude all subdirectories and their content?
For example:
cd ~/subdirectory/ && git status
should output:
fatal: Not a git repository (or any parent up to mount point /)
How to achieve this?
zsh backup git
I would like to create a backup of the .zshrc file in my ~/ directory and avoid versioning all other items. How to exclude all subdirectories and their content?
For example:
cd ~/subdirectory/ && git status
should output:
fatal: Not a git repository (or any parent up to mount point /)
How to achieve this?
zsh backup git
zsh backup git
asked Feb 1 at 18:47
Lukasz OchmanskiLukasz Ochmanski
62
62
3
I link my dot files (ln -s ~/src/dot-files/zshrc ~/.zshrc). The VCS is used in ~/src/dot-files.
– Christopher
Feb 1 at 19:17
add a comment |
3
I link my dot files (ln -s ~/src/dot-files/zshrc ~/.zshrc). The VCS is used in ~/src/dot-files.
– Christopher
Feb 1 at 19:17
3
3
I link my dot files (
ln -s ~/src/dot-files/zshrc ~/.zshrc). The VCS is used in ~/src/dot-files.– Christopher
Feb 1 at 19:17
I link my dot files (
ln -s ~/src/dot-files/zshrc ~/.zshrc). The VCS is used in ~/src/dot-files.– Christopher
Feb 1 at 19:17
add a comment |
3 Answers
3
active
oldest
votes
You can't get it to output
fatal: Not a git repository (or any parent up to mount point /)
but you can exclude all other files easily enough by adding a .gitignore file, with the contents:
*
!.zshrc
which ignores everything (*) except .zshrc.
add a comment |
Here is a common solution for this:
- Create a subdirectory someplace convenient, preferably on the same volume.
- Move your .zshrc and any other .* files you want to track in git into that directory. You may want to rename them to make them visible to normal commands or to avoid name conflicts.
- Create symlinks from the files in the new git-dir into your home directory.
- Manage the git repository in its specific location.
For example:
# Make a git directory someplace to store your config
git init ~/git/dotfiles
# Move your config to the git directory
mv ~/.zshrc ~/git/dotfiles/zshrc
# Link the config's new location into your $HOME
ln -s ~/git/dotfiles/zshrc ~/.zshrc
# Manage your new repo in its specific location
cd ~/git/dotfiles
git add zshrc
git commit -m"Initial commit"
add a comment |
One way to do this, is to use a bare git repository in a folder that you do not call .git, but for example .git-dotfiles, and use git --git-dir=~/.git-dotfiles --work-tree=~ when interacting with the dotfiles you track in your home directory. To make this easier, you'd define an alias for that. Usage could then look like: git-dotfiles add .zshrc for example.
Because git normally (without a --git-dir flag) looks only for a .git directory (or file), it will not find your .git-dotfiles directory unless you point it to it.
It is advisable to set status.showUntrackedFiles to false in that repository, otherwise it will list all files in your home directory as untracked files. With that setting it shouldn't even look at untracked files, keeping things fast.
Atlassian published a nice article explaining this method in more detail.
New contributor
M-ou-se is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f498193%2fhow-to-add-zshrc-file-into-git%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can't get it to output
fatal: Not a git repository (or any parent up to mount point /)
but you can exclude all other files easily enough by adding a .gitignore file, with the contents:
*
!.zshrc
which ignores everything (*) except .zshrc.
add a comment |
You can't get it to output
fatal: Not a git repository (or any parent up to mount point /)
but you can exclude all other files easily enough by adding a .gitignore file, with the contents:
*
!.zshrc
which ignores everything (*) except .zshrc.
add a comment |
You can't get it to output
fatal: Not a git repository (or any parent up to mount point /)
but you can exclude all other files easily enough by adding a .gitignore file, with the contents:
*
!.zshrc
which ignores everything (*) except .zshrc.
You can't get it to output
fatal: Not a git repository (or any parent up to mount point /)
but you can exclude all other files easily enough by adding a .gitignore file, with the contents:
*
!.zshrc
which ignores everything (*) except .zshrc.
answered Feb 1 at 19:04
ChrisChris
1,170616
1,170616
add a comment |
add a comment |
Here is a common solution for this:
- Create a subdirectory someplace convenient, preferably on the same volume.
- Move your .zshrc and any other .* files you want to track in git into that directory. You may want to rename them to make them visible to normal commands or to avoid name conflicts.
- Create symlinks from the files in the new git-dir into your home directory.
- Manage the git repository in its specific location.
For example:
# Make a git directory someplace to store your config
git init ~/git/dotfiles
# Move your config to the git directory
mv ~/.zshrc ~/git/dotfiles/zshrc
# Link the config's new location into your $HOME
ln -s ~/git/dotfiles/zshrc ~/.zshrc
# Manage your new repo in its specific location
cd ~/git/dotfiles
git add zshrc
git commit -m"Initial commit"
add a comment |
Here is a common solution for this:
- Create a subdirectory someplace convenient, preferably on the same volume.
- Move your .zshrc and any other .* files you want to track in git into that directory. You may want to rename them to make them visible to normal commands or to avoid name conflicts.
- Create symlinks from the files in the new git-dir into your home directory.
- Manage the git repository in its specific location.
For example:
# Make a git directory someplace to store your config
git init ~/git/dotfiles
# Move your config to the git directory
mv ~/.zshrc ~/git/dotfiles/zshrc
# Link the config's new location into your $HOME
ln -s ~/git/dotfiles/zshrc ~/.zshrc
# Manage your new repo in its specific location
cd ~/git/dotfiles
git add zshrc
git commit -m"Initial commit"
add a comment |
Here is a common solution for this:
- Create a subdirectory someplace convenient, preferably on the same volume.
- Move your .zshrc and any other .* files you want to track in git into that directory. You may want to rename them to make them visible to normal commands or to avoid name conflicts.
- Create symlinks from the files in the new git-dir into your home directory.
- Manage the git repository in its specific location.
For example:
# Make a git directory someplace to store your config
git init ~/git/dotfiles
# Move your config to the git directory
mv ~/.zshrc ~/git/dotfiles/zshrc
# Link the config's new location into your $HOME
ln -s ~/git/dotfiles/zshrc ~/.zshrc
# Manage your new repo in its specific location
cd ~/git/dotfiles
git add zshrc
git commit -m"Initial commit"
Here is a common solution for this:
- Create a subdirectory someplace convenient, preferably on the same volume.
- Move your .zshrc and any other .* files you want to track in git into that directory. You may want to rename them to make them visible to normal commands or to avoid name conflicts.
- Create symlinks from the files in the new git-dir into your home directory.
- Manage the git repository in its specific location.
For example:
# Make a git directory someplace to store your config
git init ~/git/dotfiles
# Move your config to the git directory
mv ~/.zshrc ~/git/dotfiles/zshrc
# Link the config's new location into your $HOME
ln -s ~/git/dotfiles/zshrc ~/.zshrc
# Manage your new repo in its specific location
cd ~/git/dotfiles
git add zshrc
git commit -m"Initial commit"
answered Feb 14 at 0:10
phordphord
1074
1074
add a comment |
add a comment |
One way to do this, is to use a bare git repository in a folder that you do not call .git, but for example .git-dotfiles, and use git --git-dir=~/.git-dotfiles --work-tree=~ when interacting with the dotfiles you track in your home directory. To make this easier, you'd define an alias for that. Usage could then look like: git-dotfiles add .zshrc for example.
Because git normally (without a --git-dir flag) looks only for a .git directory (or file), it will not find your .git-dotfiles directory unless you point it to it.
It is advisable to set status.showUntrackedFiles to false in that repository, otherwise it will list all files in your home directory as untracked files. With that setting it shouldn't even look at untracked files, keeping things fast.
Atlassian published a nice article explaining this method in more detail.
New contributor
M-ou-se is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
One way to do this, is to use a bare git repository in a folder that you do not call .git, but for example .git-dotfiles, and use git --git-dir=~/.git-dotfiles --work-tree=~ when interacting with the dotfiles you track in your home directory. To make this easier, you'd define an alias for that. Usage could then look like: git-dotfiles add .zshrc for example.
Because git normally (without a --git-dir flag) looks only for a .git directory (or file), it will not find your .git-dotfiles directory unless you point it to it.
It is advisable to set status.showUntrackedFiles to false in that repository, otherwise it will list all files in your home directory as untracked files. With that setting it shouldn't even look at untracked files, keeping things fast.
Atlassian published a nice article explaining this method in more detail.
New contributor
M-ou-se is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
One way to do this, is to use a bare git repository in a folder that you do not call .git, but for example .git-dotfiles, and use git --git-dir=~/.git-dotfiles --work-tree=~ when interacting with the dotfiles you track in your home directory. To make this easier, you'd define an alias for that. Usage could then look like: git-dotfiles add .zshrc for example.
Because git normally (without a --git-dir flag) looks only for a .git directory (or file), it will not find your .git-dotfiles directory unless you point it to it.
It is advisable to set status.showUntrackedFiles to false in that repository, otherwise it will list all files in your home directory as untracked files. With that setting it shouldn't even look at untracked files, keeping things fast.
Atlassian published a nice article explaining this method in more detail.
New contributor
M-ou-se is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
One way to do this, is to use a bare git repository in a folder that you do not call .git, but for example .git-dotfiles, and use git --git-dir=~/.git-dotfiles --work-tree=~ when interacting with the dotfiles you track in your home directory. To make this easier, you'd define an alias for that. Usage could then look like: git-dotfiles add .zshrc for example.
Because git normally (without a --git-dir flag) looks only for a .git directory (or file), it will not find your .git-dotfiles directory unless you point it to it.
It is advisable to set status.showUntrackedFiles to false in that repository, otherwise it will list all files in your home directory as untracked files. With that setting it shouldn't even look at untracked files, keeping things fast.
Atlassian published a nice article explaining this method in more detail.
New contributor
M-ou-se is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
M-ou-se is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered Apr 7 at 10:26
M-ou-seM-ou-se
101
101
New contributor
M-ou-se is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
M-ou-se is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
M-ou-se is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f498193%2fhow-to-add-zshrc-file-into-git%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
I link my dot files (
ln -s ~/src/dot-files/zshrc ~/.zshrc). The VCS is used in ~/src/dot-files.– Christopher
Feb 1 at 19:17