How do I discard changes in my working copy that are not in the index?
Another quicker way is:
git stash save --keep-index --include-untracked
You don't need to include
--include-untracked if you don't want to be thorough about it.
After that, you can drop that stash with a
git stash drop command if you like.
I think the functionality you're looking for can be achieved by having a branch used to deploy to your Cloud Provider.
dev branch which includes your
.gitignore file, check your incremental work into that branch.
dev branch into your
deploy branch which doesn't contain a
.gitignore file but contains the vendors directory.
once you've completed your merge, push to the deployment remote from your
node_modules directory is already tracked as part of the repository, the
.gitignore rule will not apply to it.
You need to untrack the directory from git using
git rm -r --cached node_modules git commit -m "removing node_modules"
You can run the above 2 in
After this, the
.gitignore rule will ignore the directory away.
Note that this will remove the directory
node_modules from your other repos once you pull the changes in. Only the original repo where you made that commit will still have the
node_modules folder there.
I would recommend using tags (tag tutorial)
From your master branch since you are done v1.0 add a tag called
git tag -a v1.0 -m "Tagging release 1.0"
This way you can always come back to a specific version at any time by calling
git checkout [tag_name]
Another common practice is to use branches to work on features until they are stable.
git checkout -b [feature-branch]
That creates a new branch named whatever is in
[feature-branch] and checks it out. Be sure to do this from where you want to start working on the feature (typically from
Once stable they can then be safely merged into
git merge [feature-branch]
This way your
master branch always stays in a working state and only completed items get added once ready. This will allow you to keep a working copy of the app at all times (ideally anyways) for testing, etc.
You could use branches for each version of the application however using tags makes it so you can't merge into another branch version by accident.
GitHub does not allow nested repositories (IIRC Git doesn't allow this for bare repositories).
However, you can use submodules to nest repositories on the "client side" in the working tree.
You need to clone the parent directory.
Then, add the sub-repository as a submodule:
git submodule add https://github.com/username/sub_repo.git
The sub_repo module will then be linked to the parent repo and can be found in the sub_repo directory.
Commit (.gitmodules and sub_repo), push and you're done.