Uploading your database projects on GitHub - oracle

How do you guys upload your database projects to GitHub?
I'm learning Oracle and would like to be more active on Github, but I don't know exactly how to post my projects/studies.

What I have done is create a new repository in GitHub through their web site and then clone it on my laptop using the command line version of git. Then I add my files on my laptop and do a git add, git commit, git push series of commands using git to push the committed changes back to GitHub. Here is one of my repositories for example:
https://github.com/bobbydurrett/OracleDatabaseTuningSQL
It is just a bunch of SQL*Plus scripts. When I update one or add a new one I just do the whole git add, git commit, git push sequence of steps again. I run git from the Windows command prompt.
Bobby

Related

Uploading Files from Laravel App to BitBucket

Here is what im try to achieve, I have a laravel app with a BitBucket repo in my laravel project public directory (public/repo.name).
Now what i want is to run, git add . git commit -m "Changes" and git push from my (public/repo.name) directory inside my laravel app.
I want the git commands to run when i go to lets say, http://127.0.0.1:8000/deploy this would only deploy whatever changes are in (public/repo.name)
Convert your Project to a Git Project
Open your terminal and navigate to the project root directory and run the git init command.
git init
git-init-laravel-project
Git init Laravel project
Git Add and Commit All Files
With the git init command we have successfully converted our project into a local git project. Although we have not yet added a git remote to our project.
As a second step lets go ahead and add and commit all the files to our local git repository.
Run the git add and git commit command on the project root.
git add .
git commit -m "First Commit"
The git add command adds a change in the working directory to the staging area. It tells Git that you want to include updates to a particular file in the next commit.
The git commit command commits the staged snapshot to the project history. Committed snapshots can be thought of as “safe” versions of a project—Git will never change them unless you explicitly ask it to.
Git add and Git commit on Laravel project
Create a New BitBucket Repository
We are now ready to push our changes to a remote repository. But before that we have to create a repository where we can push our changes.
Login to Bitbucket if you already have an account or SignUp for a new account. On the left hand menu , Click on the + symbol to get the option of Creating a New Repository.
Create Bitbucket empty Repo for Laravel.
Enter a suitable project name and click on Create Repository. A blank repository will be created and you will be redirected to the overview page of the repo.
Now we can go ahead and make this repo our remote repo for the Laravel project.
Add Remote Repo and Push Changes
To add the repository you just created as the remote repo for your local Laravel project. Run the following command on your project root in terminal.
git remote add origin https://<repo_owner>#bitbucket.org/<accountname>/<reponame>.git
Replace the repo_owner and accountname in the URL accordingly.
git-laravel-remote-add
git remote add laravel
Now we can go ahead and push the changes to remote repository.
git push -u origin master
git-laravel-push-bitbucket
Git push Laravel project
If you see at source in your bitbucket repository. You should see your Laravel directory structure along with the files.

How to start new Git from scratch when old Git still there

I want to create a new empty repository with git. I cannot find a simple solution online that explains this step.
This documentation states "git-init - Create an empty Git repository or reinitialize an existing one" but then doesn't say which options are needed to make it empty:
https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git-init.html
Is a --bare repository the same as an empty repository?
Problem:
I have two different projects with different repo's on github, but when I try to use Git (in Bash) after changing the directory to the new project, it keeps pushing with files from the old project.
I think the problem is that git is using the old repo files and thinks the new folder is just additional files perhaps? Basically I want to start from fresh. Can I just start from scratch on my new project with a new repo?
I have tried $ git init in a new directory, but then it just says: "Reinitialized existing Git repository in /home/user/new_project/.git/"
I tried: $ git remote set-url origin git#github.com:User/New_Project.git
but that just updates where it pushes my new project to, and then includes old projects files.
Please help a noob trying to figure things out the hard way 🙏🏼
Delete .git folder:
rm -rf .git
Then create new git repository:
git init
git remote add origin <remote-URL>
git add .
git commit -m "new clean repo"
git push --force origin master
create 1st project
make git init
create a remote repo for 1st project
link remote repo to 1st project
create 2nd project
make git init
create a remote repo for 2nd project
link remote repo to 2nd project
Git will push everything to its proper remote repo
Small hint from my side
git init : create empty repository and reinitialize an existing one
following link will give more information about different options can be used during git init ($GIT_DIR)
https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git-init.html

Push current code to existing GitHub repository

I have several Visual Studio solutions that have both a local repository and one on GitHub. I've already made many changes and successfully pushed those changes to GitHub.
But now Visual Studio has forgotten that one of my local repositories is associated with a GitHub repository and I can't seem to figure out how to reconnect it. In fact, it no longer lists that repository in my list of GitHub repositories.
In the image below, you can see I have a local repository called Toxic, but that repository does not appear in the list of GitHub repositories. If I try publishing the Toxic project to GitHub, it just tells me the repository already exists.
How the heck can I get all of my existing Github repositories to show up in the top section shown above so I can push my latest changes?
it appears the only option is to clone the GitHub repository locally, copy my modified files over the newly created repository, and then check in my changes.
Try fist:
installing Git for Windows (command-line)
cloning your remote repo in a new folder
adding your existing repository as a remote
fetching and see if you can cherry-pick your commits
That is:
git clone https://github.com/<user>/<repo> newFolder
cd newFolder
git remote add old ../path/to/old/local/repo
git fetch old
git log old/master
git cherry-pick old-sha1..old/master
(with old-sha1 being the first commit you want back)
Then add the newFolder in your Visual Studio workspace, and see if everything works (do a modification, add, commit and push)
Unless I'm missing something, it appears the only option is to clone the GitHub repository locally, copy my modified files over the newly created repository, and then check in my changes.
Of course, I lose all my comments and iterations since the last check in to GitHub. And care had to be taken not to delete the .git folder, and to copy over all changed file and delete any that had been removed. Seems like there should be an easier way but this certainly did the trick.
I'm no git expert, but I think I might be able to help, if I'm not too late.
Run:
git remote -v
This should print something in the form of:
origin <remote_repo_url> (fetch)
origin <remote_repo_url> (push)
If you only see:
origin (fetch)
origin (push)
try running:
git remote set-url origin <remote_repo_url>
If you get no output then run:
git remote add origin <remote_repo_url>
And then try
git push -u origin
The -u or --set-upstream flag will set origin as the default repo for your branches.

Ios git merge conflict in xCode

I have two branches in my project, one is develop and other is master, accidently without merging develop into master I made app live and now I have two different versions on two different branches. Let's say 1.5 version on master and 1.6 on develop, now when I tried to merge these two branches git show merge conflicts in 3 different files,
.plist
.xcodeproj
.xcworkspace
after merge when I tried to open xCode project, it failed and show error "project cannot be load.." when tried to open files manually it just doesn't open in editText. I tried sublime editor but then again I couldn't locate conflict as there were a lot of lines of code.
If you want to replace master content with dev, you should:
do a merge from master to dev, keeping dev content
then do a trivial merge from dev to master
That is:
git checkout dev
git merge --ours master
git checkout master
git merge dev
You can resolve conflicts by keeping any version (keep mine or keep theirs) of this files as they save the xcode status but they don't have your code and should not have been tracked. But don't resolve the conflicts yourself, just choose one of the versions and the project should work.
You are having this problem because you should have created a .gitignore file in your repo before creating any other file to avoid having problems with files that your ide uses but don't have the code of your app.
To avoid problems from now on, you can create the git ignore file with this content and add it to the repo.
But there are files traked that should not be. So execute this commands:
git rm -r --cached .
git add .
git commit -m "use .gitignore file"
This will delete everything from the index and add the files again applying the gitignore rules.
Check that all is working and git push to your server and you should not have more conflicts with this files for saving the xcode status.
Hello #Najam you can make change in remote branch push it to master and then try to merge remote and master
git merge remote mater:master
or you can delete the remote branch and push your remote code to master branch.

Using git-tfs fetch to get latest causes a merge conflict

I have an issue attempting to pull my latest changes from TFS and adding them to a BitBucket repo. I have successfully pushed my branches into BitBucket, but when I attempt to get any new checkins from TFS I always get a merge conflict.
Steps:
git tfs clone http://TFS-ADDRESS/Collection $/Project/Name/Branch
git tfs init-branch $/Project/Name/NewBranch NewBranchName
git push -u origin --all
At this point my BitBukcet repo has all my files and history from TFS.
I then did a checking into me $/Project/Name/NewBranch on TFS.
Now I want to get the latest changesets from TFS and add/commit them into the BitBucket repository Note: At this point, no other branch in TFS or BitBucket has changed. The only change is my single check-in into TFS
When I do the following on my NewBranch, I get a merge conflict:
git tfs pull
Auto-merging Source/build.version
CONFLICT (content): Merge conflict in Source/build.version
As far as I can tell, it is trying to merge changes from my "master" to my "NewBranch", even though NewBranch is the latest code.
The ptfs pull command is pulling the last checgeset down, but then tries to do the merge. If I use
git tfs fetch --all
I see the changeset listed, but I cannot commit/push it to the BitBucket repository. I cannot find a reference online to say what I am doing wrong, or what steps I need to take (I am new to Git). Can anyone help?
I eventually want to automate this so any check-ins in TFS can be fetched and added to the BitBucket repository (until we eventually move all developers to BitBucket)
Thanks
EDIT
I am trying to take changes from TFS to BitBucket. Nothing is getting added to TFS from BitBucket.
All work is done on a branch (see below). Users are working in TFS. Users commit their changes there. NOTE: No-one is making edits to the BitBucket repo. It is a replica of TFS.
Once a day, I want to pull the latest changesets for each TFS branch down to my local git folder and them push them into BitBucket. The "git tfs fetch" retrieves the changesets:
D:\development\workspaces\git\anothertry>git tfs fetch --all
C83419 = 3abdaedf571369dce15f74a52697d86069f87d6d
but "git status" tells me there is nothing to commit
D:\development\workspaces\git\anothertry>git status
# On branch Feature
nothing to commit, working directory clean
And when I try to push this changeset into BitBucket, git tells me there is nothing to commit.
Branches
Master---o---------------o----o--o-o--o-------
\ / / / / /
Feature-----o----o--o-o--o
I seem to have found the answer after using Git Extensions.
It seems I need to do a fetch
git tfs fetch --all
This will get me all changesets from TFS for my trunk and any branches I have mapped (init-branch)
D:\development\workspaces\git\anothertry>git tfs fetch --all
C83454 = f65ba8d0cc7b40f42148ba2c06d0da8b7e968c4d
C83455 = 6c25feb6e74a09d0d3d84344002e7546044900ab
C83459 = 91c4450d702d5a97e862aedd7ad1b5af3ff2c375
C83460 = 5cacaba5bfe4197c1bf9fab498f51c1ba435e6ea
Next I need to perform a merge
git merge <guid>
NOTE: The is for the latest changeset (in this case 5cacaba...)
Updating 6c25feb..5cacaba
Fast-forward
Source/Common/w32threads.h | 1238 ++---
Source/xxxxxxx_Service/ServerAgent.cpp | 3638 ++++++-------
Source/xxxxxxx_Service/ServerAgent.h | 449 +-
Source/xxxxxxx_Service/User.cpp | 9073 ++++++++++++++++----------------
Source/xxxxxxx_Service/User.h | 647 +--
Source/build.version | 2 +-
6 files changed, 7562 insertions(+), 7485 deletions(-)
And, finally, push my changes to BitBucket
git push --all
So, it seems I was missing the git merge call and the parameters to pass to it.
Cheers
I don't exactly understand what you do bad but there is somethings that you should now in using git-tfs...
Working with a TFS branch
I see that you created a branch (step 2) and commit in that branch.
When you have checkouted your branch 'NewBranchName', you should checkin with the command :
git tfs rcheckin -i NewBranchName
and pull modifications with :
git tfs pull -i NewBranchName
or (with rebase)
git tfs pull -r -i NewBranchName
If you don't specify the -i option with the name of the TFS remote, you will check in your commit in the main branch (here, $/Project/Name/Branch ) :(
Checkin your commits on TFS
I give you above the command to check in your commits. But you should know that, for some reasons, when you check in a git commit in TFS, a new changeset in TFS is created (that's what we want ;) ) and after a new git commit is created. It's nearly the same that the original but with some informations (that you can see in the git comment).
Due to this fact, depending on what you do (and I don't exactly understand what), you could have problems because git try to merge commit with exactly the same modifications at the same place, so fail to merge automaticaly.
In fact, I think there is something wrong in your workflow because you shouldn't encounter this problem. Try to find the problem in your workflow.
I hope it will help.
Feel free to see the git-tfs wiki : https://github.com/git-tfs/git-tfs/wiki
I hope there is quite useful informations (partly did it, with love ;) )
PS : To help you better, can you tell me which command you use to checkin your commits?
checkin, checkintoo, rcheckin? rcheckin is heavily advised!
What I do to automate your workflow :
(here 'bitbucket' is the supposed name of your remote bitbucket repository)
=> in your master branch :
//Do your job & commit with git & ...
//rebase your work on TFS work
git tfs pull -r
//rcheckin with git-tfs
git tfs rcheckin
//commit in bitbucket repo
git push bitbucket master
=> in your 'NewBranchName' branch :
//Do your job & commit with git & ...
//rebase your work on TFS work
git tfs pull -r -i NewBranchName
//rcheckin with git-tfs
git tfs rcheckin -i NewBranchName
//commit in bitbucket repo
git push bitbucket NewBranchName
PS2 : Perhaps, you should have to stash your modifications if you have uncommited changes in your working directory before doing pull -r and rcheckin...
EDIT : You edit, I edit ;)
Before, I suppose that you have defined a remote for your bitbucket repository :
git remote add bitbucket https://bitbucket.org/yout_login/your_project.git
You have just to :
//checkout your branch
git checkout NewBranchName
//fetch the TFS changesets and merge your branch into
git tfs pull -r -i NewBranchName
//push your commit on bitbucket
git push bitbucket NewBranchName
And to explain a little what you are doing (and not understand totally :( )...
With "git tfs fetch --all", you are fetching the TFS changeset of all the branches but not merging (or rebasing) with your local branch. So they doesn't appear in your local branch.
You could see the DAG with the command to better understand :
git log --oneline --graph --decorate
The 'git tfs pull' given above merge the fetched commit with your branch so that will be good!
"git status" tells me there is nothing to commit
This command show you the files that are modified in the working directory. So, that's normal that you see no changes. That does say that your commit was not pulled!
And when I try to push this changeset into BitBucket, git tells me there is nothing to commit.
You should have! Are you sure to have define your remote toward your bitbucket repository? (see above)
Which command you use? What git tell you?
The git tfs fetch command doesn't update your local git repository, that's why you should do git merge after that.
To do the same in one command simply do pull from TFS remotes
git tfs pull -r
This should update local git repository with all new updates from TFS server
At this point you just need to push updates to git server:
git push -u origin --all

Resources