As per last blog post
There is one more situation possible that we have to ignore something from local directory to remote directory
In attempt of finding soultion come across this soltuion
http://stackoverflow.com/questions/6147827/track-files-in-local-git-repo-but-ignore-in-remote
So the solution is
In local create another repo
For example it is code.git
Now we create javascript.git (We are not going to create local repo)
>cd /repo
>mkdir javascript.git
>cd javascript.git
>git --bare init
checkout that javascript.git inside code in local repository
#/var/www/html/code is the checkout of code.git
>cd /var/www/html/code
>git clone /repo/javascript.git javascript
Now here is an important factor
Create a file .gitignore
>cd /var/www/html/code
>vim .gitignore
/javascript
>cat .gitignore
/javascript
Now write something into javascript
>echo "Test" > javascript/test
>git commit -m "Javascript not going to commit"
#javascript not commited so in push master it is not going to push
>git push origin master
#Switch inside javascript
>cd javascript
>git commit -m "javascript will be commited"
>git push origin master
So,In this way javascript code will be commited locally but it will not sended to remote
There is one more situation possible that we have to ignore something from local directory to remote directory
In attempt of finding soultion come across this soltuion
http://stackoverflow.com/questions/6147827/track-files-in-local-git-repo-but-ignore-in-remote
So the solution is
In local create another repo
For example it is code.git
Now we create javascript.git (We are not going to create local repo)
>cd /repo
>mkdir javascript.git
>cd javascript.git
>git --bare init
checkout that javascript.git inside code in local repository
#/var/www/html/code is the checkout of code.git
>cd /var/www/html/code
>git clone /repo/javascript.git javascript
Now here is an important factor
Create a file .gitignore
>cd /var/www/html/code
>vim .gitignore
/javascript
>cat .gitignore
/javascript
Now write something into javascript
>echo "Test" > javascript/test
>git commit -m "Javascript not going to commit"
#javascript not commited so in push master it is not going to push
>git push origin master
#Switch inside javascript
>cd javascript
>git commit -m "javascript will be commited"
>git push origin master
So,In this way javascript code will be commited locally but it will not sended to remote
No comments:
Post a Comment