jdigger / git-process Goto Github PK
View Code? Open in Web Editor NEWScripts to help work with a good Git process
License: Apache License 2.0
Scripts to help work with a good Git process
License: Apache License 2.0
Before doing git-to-master:
-v verbose
-q quiet
etc
git fetch -p
git rebase origin/master
# resolve
git push origin _branchName_:_branchName_
To create a new feature branch based off of origin/master.
For when you want to get the changes in origin/master, but don't want to push.
Remove the remote branch and the local branch.
In other words, it should be re-entrant if run instead of "git rebase --continue" while rebasing.
git push "origin" ":GH-38" 2>&1
/Library/Ruby/Gems/1.8/gems/git-1.2.5/lib/git/lib.rb:700:in `command': git push "origin" ":GH-38" 2>&1:error: unable to push to unqualified destination: GH-38 (Git::GitExecuteError)
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'github:jdigger/git-process.git'
from ./bin/../lib/git-process/git-lib.rb:299:in `send'
from ./bin/../lib/git-process/git-lib.rb:299:in `command'
from ./bin/../lib/git-process/git-process.rb:137:in `remove_feature_branch'
from ./bin/../lib/git-process/git-process.rb:47:in `rebase_to_master'
Put it in both the README and the web site.
/Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/faraday/response/raise_octokit_error.rb:16:in `on_complete': GET http://github.webapps.rr.com/api/v3repos/webcms/omega/pulls?state=open&access_token=8ae10ff5b85706aa609ae5cbd17af4cacc05d1d5: 404: Not Found (Octokit::NotFound)
from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/response.rb:9:in `call'
from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/response.rb:63:in `on_complete'
from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/response.rb:8:in `call'
from /Library/Ruby/Gems/1.8/gems/faraday_middleware-0.8.7/lib/faraday_middleware/request/encode_json.rb:21:in `call'
from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/connection.rb:226:in `run_request'
from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/connection.rb:87:in `get'
from /Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/octokit/request.rb:40:in `send'
from /Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/octokit/request.rb:40:in `old_request'
from /Library/Ruby/Gems/1.8/gems/git-process-0.9.1.pre3/lib/git-process/github_client.rb:70:in `request'
git fetch -p
git rebase origin/master
# resolve
git push origin HEAD:master
# remove remote and local branches
Offer to remove it if it does.
Don't complain about not seeing remote branch OR parking in cleanup for to-master.
The error condition is far from clear:
/Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/faraday/response/raise_octokit_error.rb:20:in on_complete': POST https://api.github.com/repos/jdigger/git-process/pulls?access_token=49016656fa8da017934c02a72631ad366b80451b: 422: Validation Failed (Octokit::UnprocessableEntity) from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/response.rb:9:in
call'
from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/response.rb:63:in on_complete' from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/response.rb:8:in
call'
from /Library/Ruby/Gems/1.8/gems/faraday_middleware-0.8.7/lib/faraday_middleware/request/encode_json.rb:21:in call' from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/connection.rb:226:in
run_request'
from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/connection.rb:99:in post' from /Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/octokit/request.rb:40:in
send'
from /Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/octokit/request.rb:40:in request' from /Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/octokit/request.rb:18:in
post'
from /Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/octokit/client/pulls.rb:11:in create_pull_request' from /Users/jmoore/src/git-process/lib/git-process/pull-request.rb:92:in
pull_request'
from /Users/jmoore/src/git-process/lib/git-process/git-process.rb:120:in `pull_request'
from bin/git-pull-request:16
In README.md and gh-pages.
git rebase -i origin/master~1
[detached HEAD 108c9c1] Adds bin/git-new-fb
8 files changed, 269 insertions(+), 131 deletions(-)
create mode 100755 bin/git-new-fb
create mode 100644 lib/git-process/git-branch.rb
create mode 100644 lib/git-process/git-branches.rb
create mode 100644 lib/git-process/git-new-fb-options.rb
Successfully rebased and updated refs/heads/new_fb.
➜ git-process git:(new_fb) bin/git-sync
Opening existing repository at /Users/jmoore/src/git-process
Starting Git
git status "--porcelain" 2>&1
git branch "-a" "--no-color" 2>&1
git branch "-a" "--no-color" 2>&1
git fetch "-p" 2>&1
git merge "origin/master" 2>&1
git fetch "-p" 2>&1
git push "origin" "new_fb:new_fb" 2>&1
/Library/Ruby/Gems/1.8/gems/git-1.2.5/lib/git/lib.rb:700:in `command': git push "origin" "new_fb:new_fb" 2>&1:To github:jdigger/git-process.git (Git::GitExecuteError)
! [rejected] new_fb -> new_fb (non-fast-forward)
error: failed to push some refs to 'github:jdigger/git-process.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
from ./bin/../lib/git-process/git-lib.rb:277:in `send'
from ./bin/../lib/git-process/git-lib.rb:277:in `command'
from ./bin/../lib/git-process/git-lib.rb:115:in `push'
from ./bin/../lib/git-process/git-process.rb:82:in `sync_with_server'
from bin/git-sync:17
Should be quite a bit faster, but it's poorly documented.
Authorizing this to work with your repos.
Your GitHub password: xxxxxxxxxxxxxxxxxxxx
/Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/faraday/response/raise_octokit_error.rb:12:in `on_complete': POST http://github.webapps.rr.com/api/v3/authorizations: 401: Bad credentials (Octokit::Unauthorized)
/Library/Ruby/Gems/1.8/gems/git-process-0.9.3/lib/git-process/git_lib.rb:403:in `command': git checkout "-b" "bob" "/master" 2>&1:fatal: git checkout: updating paths is incompatible with switching branches. (GitProc::GitExecuteError)
Did you intend to checkout 'master' which can not be resolved as commit?
from /Library/Ruby/Gems/1.8/gems/git-process-0.9.3/lib/git-process/git_lib.rb:221:in `checkout'
from /Library/Ruby/Gems/1.8/gems/git-process-0.9.3/lib/git-process/new_fb.rb:34:in `runner'
from /Library/Ruby/Gems/1.8/gems/git-process-0.9.3/lib/git-process/git_process.rb:41:in `run'
from /Library/Ruby/Gems/1.8/gems/git-process-0.9.3/bin/git-new-fb:50
from /usr/bin/git-new-fb:19:in `load'
from /usr/bin/git-new-fb:19
➜ git-process git:(GH-40) git sync
Pushing to 'GH-40' on 'origin'.
/Users/jmoore/.rvm/gems/ruby-1.8.7-p357/gems/git-process-0.9.1.pre3/bin/../lib/git-process/git-lib.rb:404:in `command': git push "origin" "GH-40:GH-40" 2>&1:To [email protected]:jdigger/git-process.git (Git::GitExecuteError)
! [rejected] GH-40 -> GH-40 (non-fast-forward)
error: failed to push some refs to '[email protected]:jdigger/git-process.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
from /Users/jmoore/.rvm/gems/ruby-1.8.7-p357/gems/git-process-0.9.1.pre3/bin/../lib/git-process/git-lib.rb:203:in `push'
from /Users/jmoore/.rvm/gems/ruby-1.8.7-p357/gems/git-process-0.9.1.pre3/bin/../lib/git-process/git-process.rb:78:in `sync_with_server'
from /Users/jmoore/.rvm/gems/ruby-1.8.7-p357/gems/git-process-0.9.1.pre3/bin/git-sync:17
from /Users/jmoore/.rvm/gems/ruby-1.8.7-p357/bin/git-sync:19:in `load'
from /Users/jmoore/.rvm/gems/ruby-1.8.7-p357/bin/git-sync:19
In git-process.rb
def handle_merge_error(merge_error_message, merge_message)
logger.warn("Handling merge error")
git.status.each do |status|
if remerged_file?(status, merge_error_message)
lib.add(status.path)
end
end
if lib.clean_status?
lib.commit(merge_message)
else
###### it didn't work
end
end
In git-process.rb
def handle_rebase_error(rebase_error_message)
logger.warn("Handling rebase error")
git.status.each do |status|
if remerged_file?(status, rebase_error_message)
lib.add(status.path)
end
end
if lib.clean_status?
lib.rebase_continue
else
###### it didn't work
end
end
If you execute any of the commands from a subdirectory, you can hork the project.
Make rebase a CLI option.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.